Passed
Pull Request — master (#205)
by Kiran
06:14
created
geodirectory-functions/template_functions.php 3 patches
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Template functions
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+     * Template functions
4
+     *
5
+     * @since 1.0.0
6
+     * @package GeoDirectory
7
+     */
8 8
 
9 9
 /**
10 10
  * Locates template based on the template type.
@@ -29,21 +29,21 @@  discard block
 block discarded – undo
29 29
         case 'add-listing':
30 30
 
31 31
             $sc_post_type = '';
32
-			if (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
32
+            if (is_page() && isset($post->post_content) && has_shortcode($post->post_content, 'gd_add_listing')) {
33 33
                 $listing_page_id = $post->ID;
34 34
 				
35
-				$regex_pattern = get_shortcode_regex();
36
-				preg_match('/'.$regex_pattern.'/s', $post->post_content, $regex_matches);
35
+                $regex_pattern = get_shortcode_regex();
36
+                preg_match('/'.$regex_pattern.'/s', $post->post_content, $regex_matches);
37 37
 				
38
-				if (!empty($regex_matches) && isset($regex_matches[2]) == 'gd_add_listing' && isset($regex_matches[3])) {
39
-					$shortcode_atts = shortcode_parse_atts($regex_matches[3]);
40
-					$sc_post_type = !empty($shortcode_atts) && isset($shortcode_atts['listing_type']) && !empty($shortcode_atts['listing_type']) ? $shortcode_atts['listing_type'] : '';
41
-				}
38
+                if (!empty($regex_matches) && isset($regex_matches[2]) == 'gd_add_listing' && isset($regex_matches[3])) {
39
+                    $shortcode_atts = shortcode_parse_atts($regex_matches[3]);
40
+                    $sc_post_type = !empty($shortcode_atts) && isset($shortcode_atts['listing_type']) && !empty($shortcode_atts['listing_type']) ? $shortcode_atts['listing_type'] : '';
41
+                }
42 42
             } else {
43 43
                 $listing_page_id = geodir_add_listing_page_id();
44 44
             }
45 45
 			
46
-			$is_wpml = function_exists('icl_object_id') ? true : false;
46
+            $is_wpml = function_exists('icl_object_id') ? true : false;
47 47
 
48 48
             if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
49 49
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
                 if (!empty($post_types))
56 56
                     $post_type = $post_types[0];
57 57
 					
58
-				if($sc_post_type != '' )
59
-					$post_type = $sc_post_type;
58
+                if($sc_post_type != '' )
59
+                    $post_type = $sc_post_type;
60 60
 				
61 61
                 if ($is_wpml && !empty($wp->query_vars['page_id'])) {
62
-					wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
63
-				} else {
64
-					wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
65
-				}
62
+                    wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
63
+                } else {
64
+                    wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
65
+                }
66 66
                 exit();
67 67
             }
68 68
             return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
@@ -481,21 +481,21 @@  discard block
 block discarded – undo
481 481
  */
482 482
 function geodir_display_message_not_found_on_listing($template_listview = 'listing-listview', $favorite = false) {
483 483
     if ($favorite) {
484
-		$message = __('No favorite listings found which match your selection.', 'geodirectory');
485
-	} else {
486
-		$message = __('No listings found which match your selection.', 'geodirectory');
487
-	}
484
+        $message = __('No favorite listings found which match your selection.', 'geodirectory');
485
+    } else {
486
+        $message = __('No listings found which match your selection.', 'geodirectory');
487
+    }
488 488
 	
489
-	/**
490
-	 * Filter the no listing found message.
491
-	 *
492
-	 * @since 1.5.5
493
-	 * @param string $template_listview Listing listview template.
494
-	 * @param bool $favorite Are favorite listings results?
495
-	 */
496
-	$message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite);
489
+    /**
490
+     * Filter the no listing found message.
491
+     *
492
+     * @since 1.5.5
493
+     * @param string $template_listview Listing listview template.
494
+     * @param bool $favorite Are favorite listings results?
495
+     */
496
+    $message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite);
497 497
 	
498
-	echo '<li class="no-listing">' . $message . '</li>';
498
+    echo '<li class="no-listing">' . $message . '</li>';
499 499
 }
500 500
 
501 501
 /**
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
  * @return string Breadcrumb HTML.
510 510
  */
511 511
 function geodir_strip_breadcrumb_li_wrappers($breadcrumb, $separator) {
512
-	$breadcrumb = str_replace(array('</li><li>', '</li> <li>'), '', $breadcrumb);
512
+    $breadcrumb = str_replace(array('</li><li>', '</li> <li>'), '', $breadcrumb);
513 513
 	
514
-	return $breadcrumb;
514
+    return $breadcrumb;
515 515
 }
516 516
 
517 517
 /**
@@ -522,30 +522,30 @@  discard block
 block discarded – undo
522 522
  * @return string Listing listview class.
523 523
  */
524 524
 function geodir_convert_listing_view_class($columns = '') {
525
-	$class = '';
525
+    $class = '';
526 526
 	
527
-	switch ((int)$columns) {
528
-		case 1:
529
-			$class = '';
530
-		break;
531
-		case 2:
532
-			$class = 'gridview_onehalf';
533
-		break;
534
-		case 3:
535
-			$class = 'gridview_onethird';
536
-		break;
537
-		case 4:
538
-			$class = 'gridview_onefourth';
539
-		break;
540
-		case 5:
541
-			$class = 'gridview_onefifth';
542
-		break;
543
-		default:
544
-			$class = '';
545
-		break;
546
-	}
527
+    switch ((int)$columns) {
528
+        case 1:
529
+            $class = '';
530
+        break;
531
+        case 2:
532
+            $class = 'gridview_onehalf';
533
+        break;
534
+        case 3:
535
+            $class = 'gridview_onethird';
536
+        break;
537
+        case 4:
538
+            $class = 'gridview_onefourth';
539
+        break;
540
+        case 5:
541
+            $class = 'gridview_onefifth';
542
+        break;
543
+        default:
544
+            $class = '';
545
+        break;
546
+    }
547 547
 	
548
-	return $class;
548
+    return $class;
549 549
 }
550 550
 
551 551
 /**
@@ -558,18 +558,18 @@  discard block
 block discarded – undo
558 558
  * @return bool Modified value for display the excerpt.
559 559
  */
560 560
 function geodir_show_listing_post_excerpt($display, $view, $post) {
561
-	if ($view == 'listview') {
562
-		if (geodir_is_page('author')) {
563
-			$word_limit = get_option('geodir_author_desc_word_limit');
564
-		} else {
565
-			$word_limit = get_option('geodir_desc_word_limit');
566
-		}
561
+    if ($view == 'listview') {
562
+        if (geodir_is_page('author')) {
563
+            $word_limit = get_option('geodir_author_desc_word_limit');
564
+        } else {
565
+            $word_limit = get_option('geodir_desc_word_limit');
566
+        }
567 567
 		
568
-		if ($word_limit !== '' && ($word_limit == 0 || $word_limit == '0')) {
569
-			$display = false;
570
-		}
571
-	}
572
-	return $display;
568
+        if ($word_limit !== '' && ($word_limit == 0 || $word_limit == '0')) {
569
+            $display = false;
570
+        }
571
+    }
572
+    return $display;
573 573
 }
574 574
 
575 575
 /**
@@ -584,24 +584,24 @@  discard block
 block discarded – undo
584 584
  * @return string Rating icons html content.
585 585
  */
586 586
 function geodir_font_awesome_rating_form_html($html, $star_texts = array(), $default = '') {
587
-	if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
588
-		$html = '<select class="gd-fa-rating">';
589
-		$html .= '<option value=""></option>';
590
-		if (!empty($star_texts) && is_array($star_texts)) {
591
-			foreach ($star_texts as $i => $text) {
592
-				$html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>';
593
-			}
594
-		} else {
595
-			$html .= '<option value="1">1</option>';
596
-			$html .= '<option value="2">2</option>';
597
-			$html .= '<option value="3">3</option>';
598
-			$html .= '<option value="4">4</option>';
599
-			$html .= '<option value="5">5</option>';
600
-		}
601
-		$html .= '</select>';
602
-	}
603
-
604
-	return $html;
587
+    if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
588
+        $html = '<select class="gd-fa-rating">';
589
+        $html .= '<option value=""></option>';
590
+        if (!empty($star_texts) && is_array($star_texts)) {
591
+            foreach ($star_texts as $i => $text) {
592
+                $html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>';
593
+            }
594
+        } else {
595
+            $html .= '<option value="1">1</option>';
596
+            $html .= '<option value="2">2</option>';
597
+            $html .= '<option value="3">3</option>';
598
+            $html .= '<option value="4">4</option>';
599
+            $html .= '<option value="5">5</option>';
600
+        }
601
+        $html .= '</select>';
602
+    }
603
+
604
+    return $html;
605 605
 }
606 606
 
607 607
 /**
@@ -616,20 +616,20 @@  discard block
 block discarded – undo
616 616
  * @return string Rating icons html content.
617 617
  */
618 618
 function geodir_font_awesome_rating_stars_html($html, $rating, $star_count = 5) {
619
-	if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
620
-		$rating = min($rating, $star_count);
621
-		$full_stars = floor( $rating );
622
-		$half_stars = ceil( $rating - $full_stars );
623
-		$empty_stars = $star_count - $full_stars - $half_stars;
619
+    if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
620
+        $rating = min($rating, $star_count);
621
+        $full_stars = floor( $rating );
622
+        $half_stars = ceil( $rating - $full_stars );
623
+        $empty_stars = $star_count - $full_stars - $half_stars;
624 624
 		
625
-		$html = '<div class="gd-star-rating gd-fa-star-rating">';
626
-		$html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars );
627
-		$html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars );
628
-		$html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
629
-		$html .= '</div>';
630
-	}
631
-
632
-	return $html;
625
+        $html = '<div class="gd-star-rating gd-fa-star-rating">';
626
+        $html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars );
627
+        $html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars );
628
+        $html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
629
+        $html .= '</div>';
630
+    }
631
+
632
+    return $html;
633 633
 }
634 634
 
635 635
 /**
@@ -639,12 +639,12 @@  discard block
 block discarded – undo
639 639
  * @package GeoDirectory
640 640
  */
641 641
 function geodir_font_awesome_rating_css() {
642
-	// Font awesome rating style
643
-	if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
644
-		$full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575');
645
-		if ($full_color != '#757575') {
646
-			echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active:after,.br-theme-fontawesome-stars .br-widget a.br-selected:after,
642
+    // Font awesome rating style
643
+    if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
644
+        $full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575');
645
+        if ($full_color != '#757575') {
646
+            echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active:after,.br-theme-fontawesome-stars .br-widget a.br-selected:after,
647 647
 			.gd-star-rating i.fa {color:' . stripslashes($full_color) . '!important;</style>';
648
-		}
649
-	}
648
+        }
649
+    }
650 650
 }
651 651
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
                 $listing_page_id = $post->ID;
34 34
 				
35 35
 				$regex_pattern = get_shortcode_regex();
36
-				preg_match('/'.$regex_pattern.'/s', $post->post_content, $regex_matches);
36
+				preg_match('/' . $regex_pattern . '/s', $post->post_content, $regex_matches);
37 37
 				
38 38
 				if (!empty($regex_matches) && isset($regex_matches[2]) == 'gd_add_listing' && isset($regex_matches[3])) {
39 39
 					$shortcode_atts = shortcode_parse_atts($regex_matches[3]);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                 if (!empty($post_types))
56 56
                     $post_type = $post_types[0];
57 57
 					
58
-				if($sc_post_type != '' )
58
+				if ($sc_post_type != '')
59 59
 					$post_type = $sc_post_type;
60 60
 				
61 61
                 if ($is_wpml && !empty($wp->query_vars['page_id'])) {
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
      */
411 411
     do_action("geodir_get_template_part_{$slug}", $slug, $name);
412 412
     $templates = array();
413
-    $name = (string)$name;
413
+    $name = (string) $name;
414 414
     if ('' !== $name) {
415 415
         $template_name = "{$slug}-{$name}.php";
416 416
 
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 function geodir_convert_listing_view_class($columns = '') {
525 525
 	$class = '';
526 526
 	
527
-	switch ((int)$columns) {
527
+	switch ((int) $columns) {
528 528
 		case 1:
529 529
 			$class = '';
530 530
 		break;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		$html .= '<option value=""></option>';
590 590
 		if (!empty($star_texts) && is_array($star_texts)) {
591 591
 			foreach ($star_texts as $i => $text) {
592
-				$html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>';
592
+				$html .= '<option ' . selected((int) ($i + 1), (int) $default, false) . ' value="' . (int) ($i + 1) . '">' . $text . '</option>';
593 593
 			}
594 594
 		} else {
595 595
 			$html .= '<option value="1">1</option>';
@@ -618,14 +618,14 @@  discard block
 block discarded – undo
618 618
 function geodir_font_awesome_rating_stars_html($html, $rating, $star_count = 5) {
619 619
 	if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
620 620
 		$rating = min($rating, $star_count);
621
-		$full_stars = floor( $rating );
622
-		$half_stars = ceil( $rating - $full_stars );
621
+		$full_stars = floor($rating);
622
+		$half_stars = ceil($rating - $full_stars);
623 623
 		$empty_stars = $star_count - $full_stars - $half_stars;
624 624
 		
625 625
 		$html = '<div class="gd-star-rating gd-fa-star-rating">';
626
-		$html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars );
627
-		$html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars );
628
-		$html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
626
+		$html .= str_repeat('<i class="fa fa-star gd-full-star"></i>', $full_stars);
627
+		$html .= str_repeat('<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars);
628
+		$html .= str_repeat('<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
629 629
 		$html .= '</div>';
630 630
 	}
631 631
 
Please login to merge, or discard this patch.
Braces   +58 added lines, -26 removed lines patch added patch discarded remove patch
@@ -47,16 +47,19 @@  discard block
 block discarded – undo
47 47
 
48 48
             if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
49 49
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
50
-            )
51
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
50
+            ) {
51
+                            $post_type = sanitize_text_field($_REQUEST['listing_type']);
52
+            }
52 53
             if (empty($post_type) && !isset($_REQUEST['pid'])) {
53 54
                 $pagename = $wp->query_vars['pagename'];
54 55
                 $post_types = geodir_get_posttypes();
55
-                if (!empty($post_types))
56
-                    $post_type = $post_types[0];
56
+                if (!empty($post_types)) {
57
+                                    $post_type = $post_types[0];
58
+                }
57 59
 					
58
-				if($sc_post_type != '' )
59
-					$post_type = $sc_post_type;
60
+				if($sc_post_type != '' ) {
61
+									$post_type = $sc_post_type;
62
+				}
60 63
 				
61 64
                 if ($is_wpml && !empty($wp->query_vars['page_id'])) {
62 65
 					wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
@@ -71,14 +74,16 @@  discard block
 block discarded – undo
71 74
             $success_page_id = geodir_success_page_id();
72 75
             if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
73 76
                 && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
74
-            )
75
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
77
+            ) {
78
+                            $post_type = sanitize_text_field($_REQUEST['listing_type']);
79
+            }
76 80
             return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
77 81
             break;
78 82
         case 'detail':
79 83
         case 'preview':
80
-            if (in_array(get_post_type(), geodir_get_posttypes()))
81
-                $post_type = get_post_type();
84
+            if (in_array(get_post_type(), geodir_get_posttypes())) {
85
+                            $post_type = get_post_type();
86
+            }
82 87
             return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
83 88
             break;
84 89
         case 'listing':
@@ -184,7 +189,9 @@  discard block
 block discarded – undo
184 189
 
185 190
         $template = geodir_locate_template('signup');
186 191
 
187
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
192
+        if (!$template) {
193
+            $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
194
+        }
188 195
 
189 196
         /**
190 197
          * Filter the signup template path.
@@ -202,7 +209,9 @@  discard block
 block discarded – undo
202 209
 
203 210
             $template = geodir_locate_template('information');
204 211
 
205
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
212
+            if (!$template) {
213
+                $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
214
+            }
206 215
             /**
207 216
              * Filter the information template path.
208 217
              *
@@ -219,7 +228,9 @@  discard block
 block discarded – undo
219 228
             if (!$is_current_user_owner) {
220 229
                 $template = geodir_locate_template('information');
221 230
 
222
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
231
+                if (!$template) {
232
+                    $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
233
+                }
223 234
                 /**
224 235
                  * Filter the information template path.
225 236
                  *
@@ -241,7 +252,9 @@  discard block
 block discarded – undo
241 252
 
242 253
         $template = geodir_locate_template('add-listing');
243 254
 
244
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
255
+        if (!$template) {
256
+            $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
257
+        }
245 258
         /**
246 259
          * Filter the add listing template path.
247 260
          *
@@ -258,7 +271,9 @@  discard block
 block discarded – undo
258 271
 
259 272
         $template = geodir_locate_template('preview');
260 273
 
261
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
274
+        if (!$template) {
275
+            $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
276
+        }
262 277
         /**
263 278
          * Filter the preview template path.
264 279
          *
@@ -274,7 +289,9 @@  discard block
 block discarded – undo
274 289
 
275 290
         $template = geodir_locate_template('success');
276 291
 
277
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
292
+        if (!$template) {
293
+            $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
294
+        }
278 295
         /**
279 296
          * Filter the success template path.
280 297
          *
@@ -289,7 +306,9 @@  discard block
 block discarded – undo
289 306
 
290 307
         $template = geodir_locate_template('detail');
291 308
 
292
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
309
+        if (!$template) {
310
+            $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
311
+        }
293 312
         /**
294 313
          * Filter the detail template path.
295 314
          *
@@ -304,7 +323,9 @@  discard block
 block discarded – undo
304 323
 
305 324
         $template = geodir_locate_template('listing');
306 325
 
307
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
326
+        if (!$template) {
327
+            $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
328
+        }
308 329
         /**
309 330
          * Filter the listing template path.
310 331
          *
@@ -319,7 +340,9 @@  discard block
 block discarded – undo
319 340
 
320 341
         $template = geodir_locate_template('search');
321 342
 
322
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
343
+        if (!$template) {
344
+            $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
345
+        }
323 346
         /**
324 347
          * Filter the search template path.
325 348
          *
@@ -334,7 +357,9 @@  discard block
 block discarded – undo
334 357
 
335 358
         $template = geodir_locate_template('author');
336 359
 
337
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
360
+        if (!$template) {
361
+            $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
362
+        }
338 363
         /**
339 364
          * Filter the author template path.
340 365
          *
@@ -355,7 +380,9 @@  discard block
 block discarded – undo
355 380
 
356 381
             $template = geodir_locate_template('geodir-home');
357 382
 
358
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
383
+            if (!$template) {
384
+                $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
385
+            }
359 386
             /**
360 387
              * Filter the home page template path.
361 388
              *
@@ -368,7 +395,9 @@  discard block
 block discarded – undo
368 395
 
369 396
             $template = geodir_locate_template('location');
370 397
 
371
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
398
+            if (!$template) {
399
+                $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
400
+            }
372 401
             /**
373 402
              * Filter the location template path.
374 403
              *
@@ -377,8 +406,9 @@  discard block
 block discarded – undo
377 406
              */
378 407
             return $template = apply_filters('geodir_template_location', $template);
379 408
 
380
-        } else
381
-            return $template;
409
+        } else {
410
+                    return $template;
411
+        }
382 412
 
383 413
     }
384 414
 
@@ -432,8 +462,10 @@  discard block
 block discarded – undo
432 462
          * @since 1.0.0
433 463
          */
434 464
         include($template);
435
-    else:
436
-        locate_template(array("geodirectory/" . $template_name), true, false);
465
+    else {
466
+        :
467
+        locate_template(array("geodirectory/" . $template_name), true, false);
468
+    }
437 469
     endif;
438 470
 
439 471
 }
Please login to merge, or discard this patch.
geodirectory_template_tags.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -184,17 +184,17 @@  discard block
 block discarded – undo
184 184
 
185 185
     wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
186 186
     if ($is_detail_page) {
187
-		wp_enqueue_script('geodirectory-post-custom-js');
188
-	}
187
+        wp_enqueue_script('geodirectory-post-custom-js');
188
+    }
189 189
 
190 190
     // font awesome rating script
191
-	if (get_option('geodir_reviewrating_enable_font_awesome')) {
192
-		wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
193
-		wp_enqueue_script('geodir-barrating-js');
194
-	} else { // default rating script
195
-		wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
196
-		wp_enqueue_script('geodir-jRating-js');
197
-	}
191
+    if (get_option('geodir_reviewrating_enable_font_awesome')) {
192
+        wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true);
193
+        wp_enqueue_script('geodir-barrating-js');
194
+    } else { // default rating script
195
+        wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true);
196
+        wp_enqueue_script('geodir-jRating-js');
197
+    }
198 198
 
199 199
     wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js#asyncload', array(), GEODIRECTORY_VERSION, true);
200 200
     wp_enqueue_script('geodir-on-document-load');
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
  */
231 231
 function geodir_footer_scripts()
232 232
 {	
233
-	echo stripslashes(get_option('geodir_ga_tracking_code'));
233
+    echo stripslashes(get_option('geodir_ga_tracking_code'));
234 234
     echo stripslashes(get_option('geodir_footer_scripts'));
235 235
 }
236 236
 
@@ -363,9 +363,9 @@  discard block
 block discarded – undo
363 363
         return;
364 364
 
365 365
     if (!is_single()) {
366
-		if (function_exists('geodir_location_geo_home_link')) {
367
-			remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
368
-		}
366
+        if (function_exists('geodir_location_geo_home_link')) {
367
+            remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
368
+        }
369 369
         $numposts = $wp_query->found_posts;
370 370
 
371 371
 
@@ -376,22 +376,22 @@  discard block
 block discarded – undo
376 376
         }
377 377
 
378 378
         if ($max_page > 1 || $always_show) {
379
-			// Extra pagination info
380
-			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
381
-			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
382
-			$end_no = min($paged * $posts_per_page, $numposts);
379
+            // Extra pagination info
380
+            $geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
381
+            $start_no = ( $paged - 1 ) * $posts_per_page + 1;
382
+            $end_no = min($paged * $posts_per_page, $numposts);
383 383
 			
384
-			if ($geodir_pagination_more_info != '') {
385
-				$pagination_info = '<div class="gd-pagination-details">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>';
384
+            if ($geodir_pagination_more_info != '') {
385
+                $pagination_info = '<div class="gd-pagination-details">' . wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts) . '</div>';
386 386
 				
387
-				if ($geodir_pagination_more_info == 'before') {
388
-					$before = $before . $pagination_info;
389
-				} else if ($geodir_pagination_more_info == 'after') {
390
-					$after = $pagination_info . $after;
391
-				}
392
-			}
387
+                if ($geodir_pagination_more_info == 'before') {
388
+                    $before = $before . $pagination_info;
389
+                } else if ($geodir_pagination_more_info == 'after') {
390
+                    $after = $pagination_info . $after;
391
+                }
392
+            }
393 393
 			
394
-			echo "$before <div class='Navi'>";
394
+            echo "$before <div class='Navi'>";
395 395
             if ($paged >= ($pages_to_show - 1)) {
396 396
                 echo '<a href="' . str_replace('&paged', '&amp;paged', get_pagenum_link()) . '">&laquo;</a>';
397 397
             }
@@ -412,9 +412,9 @@  discard block
 block discarded – undo
412 412
             echo "</div> $after";
413 413
         }
414 414
 		
415
-		if (function_exists('geodir_location_geo_home_link')) {
416
-			add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
417
-		}
415
+        if (function_exists('geodir_location_geo_home_link')) {
416
+            add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
417
+        }
418 418
     }
419 419
 }
420 420
 
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 {
38 38
     $is_detail_page = false;
39 39
 
40
-    if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) {
40
+    if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) {
41 41
         $is_detail_page = true;
42 42
     }
43 43
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         'siteurl' => get_option('siteurl'),
52 52
         'geodir_plugin_url' => geodir_plugin_url(),
53 53
         'geodir_ajax_url' => geodir_get_ajax_url(),
54
-        'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'),
54
+        'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'),
55 55
         'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue
56 56
     );
57 57
 
@@ -72,25 +72,25 @@  discard block
 block discarded – undo
72 72
      *
73 73
      * }
74 74
      */
75
-    $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data);
75
+    $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data);
76 76
 
77 77
     wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data);
78 78
 
79 79
 
80 80
 
81 81
 
82
-    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true);
83
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');}
82
+    wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true);
83
+    if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); }
84 84
 
85 85
 
86 86
 
87
-    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true);
87
+    wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true);
88 88
     wp_enqueue_script('geodirectory-lightbox-jquery');
89 89
 
90 90
 
91 91
 
92
-    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true);
93
-    if($is_detail_page){wp_enqueue_script('geodirectory-jquery-simplemodal');}
92
+    wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true);
93
+    if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-simplemodal'); }
94 94
 
95 95
 
96 96
     //if( get_option('geodir_enqueue_google_api_script')==1)
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             wp_enqueue_script( 'geodirectory-googlemap-script' );
112 112
            }
113 113
         */
114
-    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
114
+    wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
115 115
     wp_enqueue_script('geodirectory-goMap-script');
116 116
 
117 117
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         wp_enqueue_script('plupload-all');
134 134
         wp_enqueue_script('jquery-ui-sortable');
135 135
 
136
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true);
136
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true);
137 137
         wp_enqueue_script('geodirectory-plupload-script');
138 138
 
139 139
         // SCRIPT FOR UPLOAD END
@@ -245,12 +245,12 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function geodir_add_async_forscript($url)
247 247
 {
248
-    if (strpos($url, '#asyncload')===false)
248
+    if (strpos($url, '#asyncload') === false)
249 249
         return $url;
250 250
     else if (is_admin())
251 251
         return str_replace('#asyncload', '', $url);
252 252
     else
253
-        return str_replace('#asyncload', '', $url)."' async='async";
253
+        return str_replace('#asyncload', '', $url) . "' async='async";
254 254
 }
255 255
 add_filter('clean_url', 'geodir_add_async_forscript', 11, 1);
256 256
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 {
265 265
 
266 266
 
267
-    if(get_option('geodir_scss_core')) {
267
+    if (get_option('geodir_scss_core')) {
268 268
 
269 269
 
270 270
         wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
299 299
         wp_enqueue_style('geodir-chosen-style');
300 300
 
301
-    }else{
301
+    } else {
302 302
         wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION);
303 303
         wp_enqueue_style('geodir-core-scss');
304 304
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 
307 307
     }
308 308
 
309
-    if(is_rtl()){
309
+    if (is_rtl()) {
310 310
     wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION);
311 311
     wp_enqueue_style('geodirectory-frontend-rtl-style');
312 312
     }
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         if ($max_page > 1 || $always_show) {
379 379
 			// Extra pagination info
380 380
 			$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
381
-			$start_no = ( $paged - 1 ) * $posts_per_page + 1;
381
+			$start_no = ($paged - 1) * $posts_per_page + 1;
382 382
 			$end_no = min($paged * $posts_per_page, $numposts);
383 383
 			
384 384
 			if ($geodir_pagination_more_info != '') {
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
         jQuery(function ($) {
446 446
             $("#distance_slider").slider({
447 447
                 range: true,
448
-                values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
448
+                values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>],
449 449
                 min: 0,
450 450
                 max: <?php echo $dist; ?>,
451 451
                 step: <?php echo $dist_dif; ?>,
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 
511 511
 
512 512
     <script type="text/javascript">
513
-        var default_location = '<?php if($search_location = geodir_get_default_location())  echo $search_location->city ;?>';
513
+        var default_location = '<?php if ($search_location = geodir_get_default_location())  echo $search_location->city; ?>';
514 514
         var latlng;
515 515
         var Sgeocoder;
516 516
         var address;
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 				var $form = jQuery(this).closest('form');
524 524
 				
525 525
 				if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val();
526
-				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s);
526
+				if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s);
527 527
 				
528 528
 				// Disable location based search for disabled location post type.
529 529
 				if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') {
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 					}
538 538
 				}
539 539
 				
540
-				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) {
540
+				if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) {
541 541
 					geodir_setsearch($form);
542 542
 				} else {
543 543
 					jQuery(".snear", $form).val('');
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 		});
558 558
         
559 559
 		function geodir_setsearch($form) {
560
-			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location);
560
+			if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location);
561 561
 			geocodeAddress($form);
562 562
 		}
563 563
 
@@ -570,8 +570,8 @@  discard block
 block discarded – undo
570 570
         function geocodeAddress($form) {
571 571
             Sgeocoder = new google.maps.Geocoder(); // Call the geocode function
572 572
 
573
-            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
574
-                if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) {
573
+            if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != ''  ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
574
+                if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) {
575 575
                     jQuery(".snear", $form).val('');
576 576
                 }
577 577
                 jQuery($form).submit();
@@ -579,24 +579,24 @@  discard block
 block discarded – undo
579 579
 
580 580
                 var address = jQuery(".snear", $form).val();
581 581
 
582
-                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') {
582
+                if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') {
583 583
                     initialise2();
584 584
                 } else {
585 585
 
586 586
                     Sgeocoder.geocode({'address': address<?php
587
-                    if($near_add = get_option('geodir_search_near_addition')){echo '+", '.$near_add.'"';}
588
-                    if($near_add2 =
587
+                    if ($near_add = get_option('geodir_search_near_addition')) {echo '+", ' . $near_add . '"'; }
588
+                    if ($near_add2 =
589 589
                     /**
590 590
                      * Adds any extra info to the near search box query when trying to geolocate it via google api.
591 591
                      *
592 592
                      * @since 1.0.0
593 593
                      */
594
-                    apply_filters('geodir_search_near_addition','')){echo $near_add2;}//gt_advanced_near_search();?>},
594
+                    apply_filters('geodir_search_near_addition', '')) {echo $near_add2; }//gt_advanced_near_search();?>},
595 595
                         function (results, status) {
596 596
                             if (status == google.maps.GeocoderStatus.OK) {
597 597
                                 updateSearchPosition(results[0].geometry.location, $form);
598 598
                             } else {
599
-                                alert("<?php _e('Search was not successful for the following reason:','geodirectory');?>" + status);
599
+                                alert("<?php _e('Search was not successful for the following reason:', 'geodirectory'); ?>" + status);
600 600
                             }
601 601
                         });
602 602
                 }
@@ -627,19 +627,19 @@  discard block
 block discarded – undo
627 627
             var msg;
628 628
             switch (err.code) {
629 629
                 case err.UNKNOWN_ERROR:
630
-                    msg = "<?php _e('Unable to find your location','geodirectory');?>";
630
+                    msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>";
631 631
                     break;
632 632
                 case err.PERMISSION_DENINED:
633
-                    msg = "<?php _e('Permission denied in finding your location','geodirectory');?>";
633
+                    msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>";
634 634
                     break;
635 635
                 case err.POSITION_UNAVAILABLE:
636
-                    msg = "<?php _e('Your location is currently unknown','geodirectory');?>";
636
+                    msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>";
637 637
                     break;
638 638
                 case err.BREAK:
639
-                    msg = "<?php _e('Attempt to find location took too long','geodirectory');?>";
639
+                    msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>";
640 640
                     break;
641 641
                 default:
642
-                    msg = "<?php _e('Location detection not supported in browser','geodirectory');?>";
642
+                    msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>";
643 643
             }
644 644
             jQuery('#info').html(msg);
645 645
         }
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
              * @param object $post The post object.
680 680
              * @param string $link The link to the post.
681 681
              */
682
-            return apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>',$post,$link);
682
+            return apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img">&nbsp;</span></a>', $post, $link);
683 683
             break;
684 684
         case 'new' :
685 685
             /**
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
              * @param object $post The post object.
690 690
              * @param string $link The link to the post.
691 691
              */
692
-            return apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>',$post,$link);
692
+            return apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing">&nbsp;</span></a>', $post, $link);
693 693
             break;
694 694
 
695 695
     }
Please login to merge, or discard this patch.
geodirectory-functions/post_functions.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
      * @param int $post_id The post ID.
722 722
      * @param string $postmeta Detail table column name.
723 723
      * @param string $meta_value Detail table column value.
724
-     * @return void|bool
724
+     * @return null|false
725 725
      */
726 726
     function geodir_save_post_meta($post_id, $postmeta = '', $meta_value = '')
727 727
     {
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
      * @param string $postmeta Detail table column name.
776 776
      * @todo check if this is depreciated
777 777
      * @todo Fix unknown variable mval
778
-     * @return bool
778
+     * @return boolean|null
779 779
      */
780 780
     function geodir_delete_post_meta($post_id, $postmeta)
781 781
     {
@@ -2124,7 +2124,7 @@  discard block
 block discarded – undo
2124 2124
      * @global string $plugin_prefix Geodirectory plugin table prefix.
2125 2125
      * @param int $deleted_postid The post ID.
2126 2126
      * @param bool $force Optional. Do you want to force delete it? Default: false.
2127
-     * @return bool|void
2127
+     * @return null|false
2128 2128
      */
2129 2129
     function geodir_delete_listing_info($deleted_postid, $force = false)
2130 2130
     {
@@ -2693,7 +2693,7 @@  discard block
 block discarded – undo
2693 2693
  * @since 1.0.0
2694 2694
  * @package GeoDirectory
2695 2695
  * @global object $current_user Current user object.
2696
- * @param int|string $listing_id The post ID.
2696
+ * @param integer $listing_id The post ID.
2697 2697
  * @param bool $exclude_admin Optional. Do you want to exclude admin from the check?. Default true.
2698 2698
  * @return bool
2699 2699
  */
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
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
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         $send_post_submit_mail = false;
228 228
 
229 229
         // unhook this function so it doesn't loop infinitely
230
-        remove_action('save_post', 'geodir_post_information_save',10,2);
230
+        remove_action('save_post', 'geodir_post_information_save', 10, 2);
231 231
 
232 232
         if (isset($request_info['pid']) && $request_info['pid'] != '') {
233 233
             $post['ID'] = $request_info['pid'];
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         }
252 252
 
253 253
         // re-hook this function
254
-        add_action('save_post', 'geodir_post_information_save',10,2);
254
+        add_action('save_post', 'geodir_post_information_save', 10, 2);
255 255
 
256 256
         $post_tags = '';
257 257
         if (!isset($request_info['post_tags'])) {
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $payment_info = array();
276 276
         $package_info = array();
277 277
 
278
-        $package_info = (array)geodir_post_package_info($package_info, $post);
278
+        $package_info = (array) geodir_post_package_info($package_info, $post);
279 279
 
280 280
         $post_package_id = geodir_get_post_meta($last_post_id, 'package_id');
281 281
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
                 $tmpimgArr = trim($request_info['post_images'], ",");
475 475
                 $tmpimgArr = explode(",", $tmpimgArr);
476 476
                 geodir_save_post_images($last_post_id, $tmpimgArr, $dummy);
477
-            } else{
477
+            } else {
478 478
                 geodir_save_post_images($last_post_id, $request_info['post_images'], $dummy);
479 479
             }
480 480
 
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 
659 659
             $post_meta_set_query = trim($post_meta_set_query, ", ");
660 660
 
661
-            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query);// escape %
661
+            $post_meta_set_query = str_replace('%', '%%', $post_meta_set_query); // escape %
662 662
 
663 663
             /**
664 664
              * Called before saving the listing info.
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
                 $file_path = '';
929 929
                 /* --------- start ------- */
930 930
 
931
-                $split_img_path = explode(str_replace(array('http://','https://'),'',$uploads['baseurl']), str_replace(array('http://','https://'),'',$post_image[$m]));
931
+                $split_img_path = explode(str_replace(array('http://', 'https://'), '', $uploads['baseurl']), str_replace(array('http://', 'https://'), '', $post_image[$m]));
932 932
 
933 933
                 $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
934 934
 
@@ -985,20 +985,20 @@  discard block
 block discarded – undo
985 985
                         }
986 986
 
987 987
                         $external_img = false;
988
-                        if (strpos(str_replace(array('http://','https://'),'',$curr_img_url), str_replace(array('http://','https://'),'',$uploads['baseurl'])) !== false) {
988
+                        if (strpos(str_replace(array('http://', 'https://'), '', $curr_img_url), str_replace(array('http://', 'https://'), '', $uploads['baseurl'])) !== false) {
989 989
                         } else {
990 990
                             $external_img = true;
991 991
                         }
992 992
 
993 993
                         if ($dummy || $external_img) {
994 994
                             $uploaded_file = array();
995
-                            $uploaded = (array)fetch_remote_file($curr_img_url);
995
+                            $uploaded = (array) fetch_remote_file($curr_img_url);
996 996
 
997 997
                             if (isset($uploaded['error']) && empty($uploaded['error'])) {
998 998
                                 $new_name = basename($uploaded['file']);
999 999
                                 $uploaded_file = $uploaded;
1000
-                            }else{
1001
-                                print_r($uploaded);exit;
1000
+                            } else {
1001
+                                print_r($uploaded); exit;
1002 1002
                             }
1003 1003
                             $external_img = false;
1004 1004
                         } else {
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
                                 $file_path = $sub_dir . '/' . $new_name;
1032 1032
                             }
1033 1033
 
1034
-                            $postcurr_images[] = str_replace(array('http://','https://'),'',$uploads['baseurl'] . $file_path);
1034
+                            $postcurr_images[] = str_replace(array('http://', 'https://'), '', $uploads['baseurl'] . $file_path);
1035 1035
 
1036 1036
                             if ($menu_order == 1) {
1037 1037
 
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
                 } else {
1070 1070
                     $valid_file_ids[] = $find_image;
1071 1071
 
1072
-                    $postcurr_images[] = str_replace(array('http://','https://'),'',$post_image[$m]);
1072
+                    $postcurr_images[] = str_replace(array('http://', 'https://'), '', $post_image[$m]);
1073 1073
 
1074 1074
                     $wpdb->query(
1075 1075
                         $wpdb->prepare(
@@ -1103,9 +1103,9 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
                 foreach ($post_images as $img) {
1105 1105
 
1106
-                    if (!in_array(str_replace(array('http://','https://'),'',$img->src), $postcurr_images)) {
1106
+                    if (!in_array(str_replace(array('http://', 'https://'), '', $img->src), $postcurr_images)) {
1107 1107
 
1108
-                        $invalid_files[] = (object)array('src' => $img->src);
1108
+                        $invalid_files[] = (object) array('src' => $img->src);
1109 1109
 
1110 1110
                     }
1111 1111
 
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
 
1114 1114
             }
1115 1115
 
1116
-            $invalid_files = (object)$invalid_files;
1116
+            $invalid_files = (object) $invalid_files;
1117 1117
         }
1118 1118
 
1119 1119
         $remove_files[] = $post_id;
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
         }
1248 1248
 
1249 1249
         if (!in_array($post_type, geodir_get_posttypes())) {
1250
-            return false;// if not a GD CPT return;
1250
+            return false; // if not a GD CPT return;
1251 1251
         }
1252 1252
 
1253 1253
         $table = $plugin_prefix . $post_type . '_detail';
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
              * @param string $uploads_url The server upload directory url.
1285 1285
              * @param string $uploads_baseurl The uploads dir base url.
1286 1286
              */
1287
-            $img_arr['src'] = apply_filters('geodir_get_featured_image_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1287
+            $img_arr['src'] = apply_filters('geodir_get_featured_image_src', $uploads_url . '/' . $file_name, $file_name, $uploads_url, $uploads_baseurl);
1288 1288
             $img_arr['path'] = $uploads_path . '/' . $file_name;
1289 1289
             $imagesize = getimagesize($img_arr['path']);
1290 1290
             $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
         }
1338 1338
 
1339 1339
         if (!empty($img_arr))
1340
-            return (object)$img_arr;//return (object)array( 'src' => $file_url, 'path' => $file_path );
1340
+            return (object) $img_arr; //return (object)array( 'src' => $file_url, 'path' => $file_path );
1341 1341
         else
1342 1342
             return false;
1343 1343
     }
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
                 * @param string $uploads_url The server upload directory url.
1437 1437
                 * @param string $uploads_baseurl The uploads dir base url.
1438 1438
                 */
1439
-                $img_arr['src'] = apply_filters('geodir_get_images_src',$uploads_url . '/' . $file_name,$file_name,$uploads_url,$uploads_baseurl);
1439
+                $img_arr['src'] = apply_filters('geodir_get_images_src', $uploads_url . '/' . $file_name, $file_name, $uploads_url, $uploads_baseurl);
1440 1440
                 $img_arr['path'] = $uploads_path . '/' . $file_name;
1441 1441
                 $imagesize = getimagesize($img_arr['path']);
1442 1442
                 $width = !empty($imagesize) && isset($imagesize[0]) ? $imagesize[0] : 0;
@@ -1450,11 +1450,11 @@  discard block
 block discarded – undo
1450 1450
                 $img_arr['content'] = $attechment->content; // add the description to the array
1451 1451
                 $img_arr['is_approved'] = isset($attechment->is_approved) ? $attechment->is_approved : ''; // used for user image moderation. For backward compatibility Default value is 1.
1452 1452
 
1453
-                $return_arr[] = (object)$img_arr;
1453
+                $return_arr[] = (object) $img_arr;
1454 1454
 
1455 1455
                 $counter++;
1456 1456
             }
1457
-            return (object)$return_arr;
1457
+            return (object) $return_arr;
1458 1458
         } else if ($no_images) {
1459 1459
             $default_img = '';
1460 1460
             $default_cat = geodir_get_post_meta($post_id, 'default_category', true);
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
                 $img_arr['title'] = $file_name; // add the title to the array
1490 1490
                 $img_arr['content'] = $file_name; // add the description to the array
1491 1491
 
1492
-                $return_arr[] = (object)$img_arr;
1492
+                $return_arr[] = (object) $img_arr;
1493 1493
 
1494 1494
                 return $return_arr;
1495 1495
             } else
@@ -1516,8 +1516,8 @@  discard block
 block discarded – undo
1516 1516
 
1517 1517
         $html = '';
1518 1518
         if (!empty($request)) {
1519
-            if (!is_object($request)){
1520
-                $request = (object)$request;
1519
+            if (!is_object($request)) {
1520
+                $request = (object) $request;
1521 1521
             }
1522 1522
 
1523 1523
             if (isset($request->src) && !isset($request->path)) {
@@ -1528,10 +1528,10 @@  discard block
 block discarded – undo
1528 1528
              * getimagesize() works faster from path than url so we try and get path if we can.
1529 1529
              */
1530 1530
             $upload_dir = wp_upload_dir();
1531
-            $img_no_http = str_replace(array("http://","https://"),"",$request->path);
1532
-            $upload_no_http = str_replace(array("http://","https://"),"",$upload_dir['baseurl']);
1533
-            if (strpos($img_no_http ,$upload_no_http ) !== false) {
1534
-                $request->path = str_replace( $img_no_http,$upload_dir['basedir'],$request->path);
1531
+            $img_no_http = str_replace(array("http://", "https://"), "", $request->path);
1532
+            $upload_no_http = str_replace(array("http://", "https://"), "", $upload_dir['baseurl']);
1533
+            if (strpos($img_no_http, $upload_no_http) !== false) {
1534
+                $request->path = str_replace($img_no_http, $upload_dir['basedir'], $request->path);
1535 1535
             }
1536 1536
 
1537 1537
             $imagesize = getimagesize($request->path);
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
             $image->width = $width;
1542 1542
             $image->height = $height;
1543 1543
 
1544
-            $max_size = (object)geodir_get_imagesize($size);
1544
+            $max_size = (object) geodir_get_imagesize($size);
1545 1545
 
1546 1546
             if (!is_wp_error($max_size)) {
1547 1547
 
@@ -1555,10 +1555,10 @@  discard block
 block discarded – undo
1555 1555
                         $width_per = 100;
1556 1556
                 }
1557 1557
 
1558
-                if (is_admin() && !isset($_REQUEST['geodir_ajax'])){
1558
+                if (is_admin() && !isset($_REQUEST['geodir_ajax'])) {
1559 1559
                     $html = '<div class="geodir_thumbnail"><img style="max-height:' . $max_size->h . 'px;" alt="place image" src="' . $image->src . '"  /></div>';
1560 1560
                 }
1561
-                else{
1561
+                else {
1562 1562
                     $html = '<div class="geodir_thumbnail" style="background-image:url(\'' . $image->src . '\');"></div>';
1563 1563
                 }
1564 1564
 
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
                                     } ?>"><img alt="bubble image" style="max-height:50px;"
1888 1888
                                                src="<?php echo $post_images[0]; ?>"/></a></div>
1889 1889
                             <?php
1890
-                            }else{
1890
+                            } else {
1891 1891
                                 echo '<div class="geodir-bubble_image"></div>';
1892 1892
                             }
1893 1893
                         } else {
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
                                 ?>
1896 1896
                                 <div class="geodir-bubble_image"><a href="<?php echo $plink; ?>"><?php echo $image; ?></a></div>
1897 1897
                             <?php
1898
-                            }else{
1898
+                            } else {
1899 1899
                                 echo '<div class="geodir-bubble_image"></div>';
1900 1900
                             }
1901 1901
                         }
@@ -1929,7 +1929,7 @@  discard block
 block discarded – undo
1929 1929
                              * @param object $postinfo_obj The posts info as an object.
1930 1930
                              * @param bool|string $post_preview True if currently in post preview page. Empty string if not.                           *
1931 1931
                              */
1932
-                            do_action('geodir_infowindow_meta_after',$postinfo_obj,$post_preview );
1932
+                            do_action('geodir_infowindow_meta_after', $postinfo_obj, $post_preview);
1933 1933
                             ?>
1934 1934
                         </div>
1935 1935
                         <?php
@@ -1941,10 +1941,10 @@  discard block
 block discarded – undo
1941 1941
                             <div class="geodir-bubble-meta-fade"></div>
1942 1942
 
1943 1943
                             <div class="geodir-bubble-meta-bottom">
1944
-                                <span class="geodir-bubble-rating"><?php echo $rating_star;?></span>
1944
+                                <span class="geodir-bubble-rating"><?php echo $rating_star; ?></span>
1945 1945
 
1946 1946
                                 <span
1947
-                                    class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID);?></span>
1947
+                                    class="geodir-bubble-fav"><?php echo geodir_favourite_html($post_author, $ID); ?></span>
1948 1948
                   <span class="geodir-bubble-reviews"><a href="<?php echo get_comments_link($ID); ?>"
1949 1949
                                                          class="geodir-pcomments"><i class="fa fa-comments"></i>
1950 1950
                           <?php echo get_comments_number($ID); ?>
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
          */
2240 2240
         do_action('geodir_before_add_from_favorite', $post_id);
2241 2241
 
2242
-        echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="'. $favourite_icon .'"></i> ' . $unfavourite_text . '</a>';
2242
+        echo '<a href="javascript:void(0);" title="' . $remove_favourite_text . '" class="geodir-addtofav geodir-removetofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'remove\');"><i class="' . $favourite_icon . '"></i> ' . $unfavourite_text . '</a>';
2243 2243
 
2244 2244
         /**
2245 2245
          * Called after adding the post from favourites.
@@ -2318,7 +2318,7 @@  discard block
 block discarded – undo
2318 2318
          */
2319 2319
         do_action('geodir_before_remove_from_favorite', $post_id);
2320 2320
 
2321
-        echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="'. $favourite_icon .'"></i> ' . $favourite_text . '</a>';
2321
+        echo '<a href="javascript:void(0);"  title="' . $add_favourite_text . '" class="geodir-addtofav geodir-addtofav-icon" onclick="javascript:addToFavourite(\'' . $post_id . '\',\'add\');"><i class="' . $favourite_icon . '"></i> ' . $favourite_text . '</a>';
2322 2322
 
2323 2323
         /**
2324 2324
          * Called after removing the post from favourites.
@@ -2413,10 +2413,10 @@  discard block
 block discarded – undo
2413 2413
             $user_meta_data = get_user_meta($current_user->data->ID, 'gd_user_favourite_post', true);
2414 2414
 
2415 2415
         if (!empty($user_meta_data) && in_array($post_id, $user_meta_data)) {
2416
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"  ><a
2416
+            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"  ><a
2417 2417
                 class="geodir-removetofav-icon" href="javascript:void(0);"
2418
-                onclick="javascript:addToFavourite(<?php echo $post_id;?>,'remove');"
2419
-                title="<?php echo $remove_favourite_text;?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text;?>
2418
+                onclick="javascript:addToFavourite(<?php echo $post_id; ?>,'remove');"
2419
+                title="<?php echo $remove_favourite_text; ?>"><i class="<?php echo $unfavourite_icon; ?>"></i> <?php echo $unfavourite_text; ?>
2420 2420
             </a>   </span><?php
2421 2421
 
2422 2422
         } else {
@@ -2426,11 +2426,11 @@  discard block
 block discarded – undo
2426 2426
             } else
2427 2427
                 $script_text = 'javascript:addToFavourite(' . $post_id . ',\'add\')';
2428 2428
 
2429
-            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id;?>"><a class="geodir-addtofav-icon"
2429
+            ?><span class="geodir-addtofav favorite_property_<?php echo $post_id; ?>"><a class="geodir-addtofav-icon"
2430 2430
                                                                                         href="javascript:void(0);"
2431
-                                                                                        onclick="<?php echo $script_text;?>"
2432
-                                                                                        title="<?php echo $add_favourite_text;?>"><i
2433
-                    class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text;?></a></span>
2431
+                                                                                        onclick="<?php echo $script_text; ?>"
2432
+                                                                                        title="<?php echo $add_favourite_text; ?>"><i
2433
+                    class="<?php echo $favourite_icon; ?>"></i> <?php echo $favourite_text; ?></a></span>
2434 2434
         <?php }
2435 2435
     }
2436 2436
 }
@@ -3029,15 +3029,15 @@  discard block
 block discarded – undo
3029 3029
  * @since 1.4.9
3030 3030
  * @package GeoDirectory
3031 3031
  */
3032
-function geodir_fb_like_thumbnail(){
3032
+function geodir_fb_like_thumbnail() {
3033 3033
 
3034 3034
     // return if not a single post
3035
-    if(!is_single()){return;}
3035
+    if (!is_single()) {return; }
3036 3036
 
3037 3037
     global $post;
3038
-    if(isset($post->featured_image) && $post->featured_image){
3038
+    if (isset($post->featured_image) && $post->featured_image) {
3039 3039
         $upload_dir = wp_upload_dir();
3040
-        $thumb = $upload_dir['baseurl'].$post->featured_image;
3040
+        $thumb = $upload_dir['baseurl'] . $post->featured_image;
3041 3041
         echo "\n\n<!-- GD Facebook Like Thumbnail -->\n<link rel=\"image_src\" href=\"$thumb\" />\n<!-- End GD Facebook Like Thumbnail -->\n\n";
3042 3042
 
3043 3043
     }
Please login to merge, or discard this patch.
geodirectory-admin/admin_functions.php 2 patches
Indentation   +891 added lines, -891 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Admin functions.
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+     * Admin functions.
4
+     *
5
+     * @since 1.0.0
6
+     * @package GeoDirectory
7
+     */
8 8
 
9 9
 /**
10 10
  * Updates option value when GeoDirectory get deactivated.
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
         wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
133 133
         wp_enqueue_script('geodirectory-goMap-script');
134 134
 
135
-		// font awesome rating script
136
-		if (get_option('geodir_reviewrating_enable_font_awesome')) {
137
-			wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
138
-			wp_enqueue_script('geodir-barrating-js');
139
-		} else { // default rating script
140
-			wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
141
-			wp_enqueue_script('geodir-jRating-js');
142
-		}
135
+        // font awesome rating script
136
+        if (get_option('geodir_reviewrating_enable_font_awesome')) {
137
+            wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
138
+            wp_enqueue_script('geodir-barrating-js');
139
+        } else { // default rating script
140
+            wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
141
+            wp_enqueue_script('geodir-jRating-js');
142
+        }
143 143
 
144 144
         wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
145 145
         wp_enqueue_script('geodir-on-document-load');
@@ -337,13 +337,13 @@  discard block
 block discarded – undo
337 337
                 flush_rewrite_rules(false);
338 338
 
339 339
                 break;
340
-			case 'fail':
341
-				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
340
+            case 'fail':
341
+                $gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
342 342
 				
343
-				if ($gderr == 21)
344
-			    	echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
345
-				else
346
-					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
343
+                if ($gderr == 21)
344
+                    echo '<div id="message" class="error fade"><p><strong>' . __('Error: You can not add same permalinks for both Listing and Location, please try again.', 'geodirectory') . '</strong></p></div>';
345
+                else
346
+                    echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
347 347
                 break;
348 348
         }
349 349
     }
@@ -383,15 +383,15 @@  discard block
 block discarded – undo
383 383
         if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
384 384
         if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
385 385
 		
386
-		/**
387
-		 * Fires before updating geodirectory admin settings.
388
-		 *
389
-		 * @since 1.4.2
390
-		 *
391
-		 * @param string $current_tab Current tab in geodirectory settings.
392
-		 * @param array  $geodir_settings Array of geodirectory settings.
393
-		 */
394
-		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
386
+        /**
387
+         * Fires before updating geodirectory admin settings.
388
+         *
389
+         * @since 1.4.2
390
+         *
391
+         * @param string $current_tab Current tab in geodirectory settings.
392
+         * @param array  $geodir_settings Array of geodirectory settings.
393
+         */
394
+        do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
395 395
 		
396 396
         if (!empty($geodir_settings[$current_tab]))
397 397
             geodir_update_options($geodir_settings[$current_tab]);
@@ -480,11 +480,11 @@  discard block
 block discarded – undo
480 480
                 <?php
481 481
 
482 482
                     $default_location = geodir_get_default_location();
483
-                  $city =  isset($default_location->city) ? $default_location->city : '';
484
-                  $region =isset($default_location->region) ? $default_location->region : '';
485
-                  $country =isset($default_location->country) ? $default_location->country : '';
486
-                  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
-                  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
483
+                    $city =  isset($default_location->city) ? $default_location->city : '';
484
+                    $region =isset($default_location->region) ? $default_location->region : '';
485
+                    $country =isset($default_location->country) ? $default_location->country : '';
486
+                    $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
+                    $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
488 488
 
489 489
                 ?>
490 490
                 var geocoder = new google.maps.Geocoder();
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
  */
758 758
 function geodir_update_options($options, $dummy = false)
759 759
 {
760
-   // print_r($_POST);    print_r($options);    exit;
760
+    // print_r($_POST);    print_r($options);    exit;
761 761
 
762 762
     if ((!isset($_POST) || !$_POST) && !$dummy) return false;
763 763
 
@@ -2253,10 +2253,10 @@  discard block
 block discarded – undo
2253 2253
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2254 2254
                                            style=" <?php echo esc_attr($value['css']); ?>"
2255 2255
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
2256
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
2257
-                                           } else {
2258
-                                               echo esc_attr($value['std']);
2259
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
2256
+                                                echo esc_attr(stripslashes(get_option($value['id'])));
2257
+                                            } else {
2258
+                                                echo esc_attr($value['std']);
2259
+                                            } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
2260 2260
                 </tr><?php
2261 2261
                 break;
2262 2262
 
@@ -2270,10 +2270,10 @@  discard block
 block discarded – undo
2270 2270
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2271 2271
                                            style="<?php echo esc_attr($value['css']); ?>"
2272 2272
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
2273
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
2274
-                                           } else {
2275
-                                               echo esc_attr($value['std']);
2276
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
2273
+                                                echo esc_attr(stripslashes(get_option($value['id'])));
2274
+                                            } else {
2275
+                                                echo esc_attr($value['std']);
2276
+                                            } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
2277 2277
                 </tr><?php
2278 2278
                 break;
2279 2279
 
@@ -2293,10 +2293,10 @@  discard block
 block discarded – undo
2293 2293
                                            id="<?php echo esc_attr($value['id']); ?>" type="text"
2294 2294
                                            style="<?php echo esc_attr($value['css']); ?>"
2295 2295
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
2296
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
2297
-                                           } else {
2298
-                                               echo esc_attr($value['std']);
2299
-                                           } ?>" class="colorpick"/> <span
2296
+                                                echo esc_attr(stripslashes(get_option($value['id'])));
2297
+                                            } else {
2298
+                                                echo esc_attr($value['std']);
2299
+                                            } ?>" class="colorpick"/> <span
2300 2300
                         class="description"><?php echo $value['desc']; ?></span>
2301 2301
 
2302 2302
                     <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv"
@@ -2685,22 +2685,22 @@  discard block
 block discarded – undo
2685 2685
 
2686 2686
             case 'single_select_page' :
2687 2687
                 // WPML
2688
-				$switch_lang = false;
2689
-				$disabled = '';
2690
-				if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
2691
-					global $sitepress;
2688
+                $switch_lang = false;
2689
+                $disabled = '';
2690
+                if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
2691
+                    global $sitepress;
2692 2692
 					
2693
-					$default_lang = $sitepress->get_default_language();
2694
-					$current_lang = $sitepress->get_current_language();
2693
+                    $default_lang = $sitepress->get_default_language();
2694
+                    $current_lang = $sitepress->get_current_language();
2695 2695
 					
2696
-					if ($current_lang != 'all' && $current_lang != $default_lang) {
2697
-						$disabled = "disabled='disabled'";
2698
-						$switch_lang = $current_lang;
2699
-						$sitepress->switch_lang('all', true);
2700
-					}
2701
-				}
2702
-				//
2703
-				$page_setting = (int)get_option($value['id']);
2696
+                    if ($current_lang != 'all' && $current_lang != $default_lang) {
2697
+                        $disabled = "disabled='disabled'";
2698
+                        $switch_lang = $current_lang;
2699
+                        $sitepress->switch_lang('all', true);
2700
+                    }
2701
+                }
2702
+                //
2703
+                $page_setting = (int)get_option($value['id']);
2704 2704
 
2705 2705
                 $args = array('name' => $value['id'],
2706 2706
                     'id' => $value['id'],
@@ -2721,9 +2721,9 @@  discard block
 block discarded – undo
2721 2721
                     <span class="description"><?php echo $value['desc'] ?></span>
2722 2722
                 </td>
2723 2723
                 </tr><?php
2724
-				if ($switch_lang) {
2725
-					$sitepress->switch_lang($switch_lang, true);
2726
-				}
2724
+                if ($switch_lang) {
2725
+                    $sitepress->switch_lang($switch_lang, true);
2726
+                }
2727 2727
                 break;
2728 2728
             case 'single_select_country' :
2729 2729
                 $countries = $geodirectory->countries->countries;
@@ -3355,22 +3355,22 @@  discard block
 block discarded – undo
3355 3355
  * @return string Post type ex: gd_place
3356 3356
  */
3357 3357
 function geodir_admin_current_post_type() {
3358
-	global $post, $typenow, $current_screen;
3358
+    global $post, $typenow, $current_screen;
3359 3359
 	
3360
-	$post_type = NULL;
3360
+    $post_type = NULL;
3361 3361
 	
3362
-	if ($post && isset($post->post_type))
3363
-		$post_type = $post->post_type;
3364
-	elseif ($typenow)
3365
-		$post_type = $typenow;
3366
-	elseif ($current_screen && isset($current_screen->post_type))
3367
-		$post_type = $current_screen->post_type;
3368
-	elseif (isset($_REQUEST['post_type']))
3369
-		$post_type = sanitize_key($_REQUEST['post_type']);
3370
-	elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
3371
-		$post_type = get_post_type($_REQUEST['post']);
3372
-
3373
-	return $post_type;
3362
+    if ($post && isset($post->post_type))
3363
+        $post_type = $post->post_type;
3364
+    elseif ($typenow)
3365
+        $post_type = $typenow;
3366
+    elseif ($current_screen && isset($current_screen->post_type))
3367
+        $post_type = $current_screen->post_type;
3368
+    elseif (isset($_REQUEST['post_type']))
3369
+        $post_type = sanitize_key($_REQUEST['post_type']);
3370
+    elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
3371
+        $post_type = get_post_type($_REQUEST['post']);
3372
+
3373
+    return $post_type;
3374 3374
 }
3375 3375
 
3376 3376
 /**
@@ -3385,33 +3385,33 @@  discard block
 block discarded – undo
3385 3385
  * @param array  $geodir_settings Array of geodirectory settings.
3386 3386
  */
3387 3387
 function geodir_before_update_options($current_tab, $geodir_settings) {
3388
-	$active_tab = isset($_REQUEST['active_tab']) ? trim($_REQUEST['active_tab']) : '';
3388
+    $active_tab = isset($_REQUEST['active_tab']) ? trim($_REQUEST['active_tab']) : '';
3389 3389
 		
3390
-	// Permalink settings
3391
-	if ($current_tab == 'permalink_settings') {
3392
-		$listing_prefix = isset($_POST['geodir_listing_prefix']) ? trim($_POST['geodir_listing_prefix']) : '';
3393
-		$location_prefix = isset($_POST['geodir_location_prefix']) ? trim($_POST['geodir_location_prefix']) : '';
3390
+    // Permalink settings
3391
+    if ($current_tab == 'permalink_settings') {
3392
+        $listing_prefix = isset($_POST['geodir_listing_prefix']) ? trim($_POST['geodir_listing_prefix']) : '';
3393
+        $location_prefix = isset($_POST['geodir_location_prefix']) ? trim($_POST['geodir_location_prefix']) : '';
3394 3394
 		
3395
-		// Don't allow same slug url for listing and location
3396
-		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
3397
-			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
3398
-        	wp_redirect($redirect_url);
3399
-			exit;
3400
-		}
3395
+        // Don't allow same slug url for listing and location
3396
+        if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
3397
+            $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
3398
+            wp_redirect($redirect_url);
3399
+            exit;
3400
+        }
3401 3401
 		
3402
-		// Don't allow to update page settings on different language.
3403
-		if (geodir_is_wpml()) {
3404
-			global $sitepress;
3405
-			$current_language = $sitepress->get_current_language();
3406
-			$default_language = $sitepress->get_default_language();
3402
+        // Don't allow to update page settings on different language.
3403
+        if (geodir_is_wpml()) {
3404
+            global $sitepress;
3405
+            $current_language = $sitepress->get_current_language();
3406
+            $default_language = $sitepress->get_default_language();
3407 3407
 			
3408
-			if ($current_language != 'all' && $current_language != $default_language) {
3409
-				$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab);
3410
-				wp_redirect($redirect_url);
3411
-				exit;
3412
-			}
3413
-		}
3414
-	}
3408
+            if ($current_language != 'all' && $current_language != $default_language) {
3409
+                $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab);
3410
+                wp_redirect($redirect_url);
3411
+                exit;
3412
+            }
3413
+        }
3414
+    }
3415 3415
 }
3416 3416
 
3417 3417
 
@@ -3442,7 +3442,7 @@  discard block
 block discarded – undo
3442 3442
  * @return array Array of tab data.
3443 3443
  */
3444 3444
 function geodir_import_export_tab( $tabs ) {
3445
-	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
3445
+    $tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
3446 3446
     return $tabs;
3447 3447
 }
3448 3448
 
@@ -3456,8 +3456,8 @@  discard block
 block discarded – undo
3456 3456
  * @return string Html content.
3457 3457
  */
3458 3458
 function geodir_import_export_page() {
3459
-	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
3460
-	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
3459
+    $nonce = wp_create_nonce( 'geodir_import_export_nonce' );
3460
+    $gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
3461 3461
     /**
3462 3462
      * Filter sample category data csv file url.
3463 3463
      *
@@ -3466,9 +3466,9 @@  discard block
 block discarded – undo
3466 3466
      *
3467 3467
      * @param string $gd_cats_sample_csv Sample category data csv file url.
3468 3468
      */
3469
-	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
3469
+    $gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
3470 3470
 	
3471
-	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
3471
+    $gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
3472 3472
     /**
3473 3473
      * Filter sample post data csv file url.
3474 3474
      *
@@ -3479,42 +3479,42 @@  discard block
 block discarded – undo
3479 3479
      */
3480 3480
     $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
3481 3481
 	
3482
-	$gd_posttypes = geodir_get_posttypes( 'array' );
3482
+    $gd_posttypes = geodir_get_posttypes( 'array' );
3483 3483
 	
3484
-	$gd_posttypes_option = '';
3485
-	foreach ( $gd_posttypes as $gd_posttype => $row ) {
3486
-		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>';
3487
-	}
3488
-	wp_enqueue_script( 'jquery-ui-progressbar' );
3484
+    $gd_posttypes_option = '';
3485
+    foreach ( $gd_posttypes as $gd_posttype => $row ) {
3486
+        $gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>';
3487
+    }
3488
+    wp_enqueue_script( 'jquery-ui-progressbar' );
3489 3489
 	
3490
-	$gd_chunksize_options = array();
3491
-	$gd_chunksize_options[100] = 100;
3492
-	$gd_chunksize_options[200] = 200;
3493
-	$gd_chunksize_options[500] = 500;
3494
-	$gd_chunksize_options[1000] = 1000;
3495
-	$gd_chunksize_options[2000] = 2000;
3496
-	$gd_chunksize_options[5000] = 5000;
3497
-	$gd_chunksize_options[10000] = 10000;
3498
-	$gd_chunksize_options[20000] = 20000;
3499
-	$gd_chunksize_options[50000] = 50000;
3500
-	$gd_chunksize_options[100000] = 100000;
3490
+    $gd_chunksize_options = array();
3491
+    $gd_chunksize_options[100] = 100;
3492
+    $gd_chunksize_options[200] = 200;
3493
+    $gd_chunksize_options[500] = 500;
3494
+    $gd_chunksize_options[1000] = 1000;
3495
+    $gd_chunksize_options[2000] = 2000;
3496
+    $gd_chunksize_options[5000] = 5000;
3497
+    $gd_chunksize_options[10000] = 10000;
3498
+    $gd_chunksize_options[20000] = 20000;
3499
+    $gd_chunksize_options[50000] = 50000;
3500
+    $gd_chunksize_options[100000] = 100000;
3501 3501
 	 
3502
-	 /**
3503
-     * Filter max entries per export csv file.
3504
-     *
3505
-     * @since 1.5.6
3506
-     * @package GeoDirectory
3507
-     *
3508
-     * @param string $gd_chunksize_options Entries options.
3509
-     */
3502
+        /**
3503
+         * Filter max entries per export csv file.
3504
+         *
3505
+         * @since 1.5.6
3506
+         * @package GeoDirectory
3507
+         *
3508
+         * @param string $gd_chunksize_options Entries options.
3509
+         */
3510 3510
     $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
3511 3511
 	
3512
-	$gd_chunksize_option = '';
3513
-	foreach ($gd_chunksize_options as $value => $title) {
3514
-		$gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>';
3515
-	}
3512
+    $gd_chunksize_option = '';
3513
+    foreach ($gd_chunksize_options as $value => $title) {
3514
+        $gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>';
3515
+    }
3516 3516
 	
3517
-	$uploads = wp_upload_dir();
3517
+    $uploads = wp_upload_dir();
3518 3518
 ?>
3519 3519
 </form>
3520 3520
 <div class="inner_content_tab_main gd-import-export">
@@ -3576,13 +3576,13 @@  discard block
 block discarded – undo
3576 3576
 							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
3577 3577
 						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" />
3578 3578
 							<?php
3579
-							/**
3580
-							 * Called just after the sample CSV download link.
3581
-							 *
3582
-							 * @since 1.0.0
3583
-							 */
3584
-							do_action('geodir_sample_csv_download_link');
3585
-							?>
3579
+                            /**
3580
+                             * Called just after the sample CSV download link.
3581
+                             *
3582
+                             * @since 1.0.0
3583
+                             */
3584
+                            do_action('geodir_sample_csv_download_link');
3585
+                            ?>
3586 3586
 							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span>
3587 3587
 							<div class="filelist"></div>
3588 3588
 						</div>
@@ -3690,14 +3690,14 @@  discard block
 block discarded – undo
3690 3690
 							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
3691 3691
 						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" />
3692 3692
 						<?php
3693
-						/**
3694
-						 * Called just after the sample CSV download link.
3695
-						 *
3696
-						 * @since 1.0.0
3693
+                        /**
3694
+                         * Called just after the sample CSV download link.
3695
+                         *
3696
+                         * @since 1.0.0
3697 3697
                          * @package GeoDirectory
3698
-						 */
3699
-						do_action('geodir_sample_cats_csv_download_link');
3700
-						?>
3698
+                         */
3699
+                        do_action('geodir_sample_cats_csv_download_link');
3700
+                        ?>
3701 3701
 							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span>
3702 3702
 							<div class="filelist"></div>
3703 3703
 						</div>
@@ -3773,19 +3773,19 @@  discard block
 block discarded – undo
3773 3773
       </div>
3774 3774
     </div>
3775 3775
 	<?php
3776
-	/**
3777
-	 * Allows you to add more setting to the GD > Import & Export page.
3778
-	 *
3779
-	 * Called after the last setting on the GD > Import & Export page.
3780
-	 * @since 1.4.6
3776
+    /**
3777
+     * Allows you to add more setting to the GD > Import & Export page.
3778
+     *
3779
+     * Called after the last setting on the GD > Import & Export page.
3780
+     * @since 1.4.6
3781 3781
      * @package GeoDirectory
3782
-	 *
3783
-	 * @param array $gd_posttypes GD post types.
3782
+     *
3783
+     * @param array $gd_posttypes GD post types.
3784 3784
      * @param array $gd_chunksize_options File chunk size options.
3785 3785
      * @param string $nonce Wordpress security token for GD import & export.
3786
-	 */
3787
-	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
3788
-	?>
3786
+     */
3787
+    do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
3788
+    ?>
3789 3789
   </div>
3790 3790
 </div>
3791 3791
 <script type="text/javascript">
@@ -5760,32 +5760,32 @@  discard block
 block discarded – undo
5760 5760
  * @return int|bool Term id when success, false when fail.
5761 5761
  */
5762 5762
 function geodir_imex_insert_term( $taxonomy, $term_data ) {
5763
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5764
-		return false;
5765
-	}
5763
+    if ( empty( $taxonomy ) || empty( $term_data ) ) {
5764
+        return false;
5765
+    }
5766 5766
 	
5767
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5768
-	$args = array();
5769
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5770
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5771
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5767
+    $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5768
+    $args = array();
5769
+    $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5770
+    $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5771
+    $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5772 5772
 	
5773
-	if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
5774
-		$term_args = array_merge( $term_data, $args );
5775
-		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5776
-		$term_args = wp_parse_args( $term_args, $defaults );
5777
-		$term_args = sanitize_term( $term_args, $taxonomy, 'db' );
5778
-		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5779
-	}
5773
+    if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
5774
+        $term_args = array_merge( $term_data, $args );
5775
+        $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5776
+        $term_args = wp_parse_args( $term_args, $defaults );
5777
+        $term_args = sanitize_term( $term_args, $taxonomy, 'db' );
5778
+        $args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5779
+    }
5780 5780
 	
5781 5781
     if( !empty( $term ) ) {
5782
-		$result = wp_insert_term( $term, $taxonomy, $args );
5782
+        $result = wp_insert_term( $term, $taxonomy, $args );
5783 5783
         if( !is_wp_error( $result ) ) {
5784 5784
             return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5785 5785
         }
5786 5786
     }
5787 5787
 	
5788
-	return false;
5788
+    return false;
5789 5789
 }
5790 5790
 
5791 5791
 /**
@@ -5812,39 +5812,39 @@  discard block
 block discarded – undo
5812 5812
  * @return int|bool Term id when success, false when fail.
5813 5813
  */
5814 5814
 function geodir_imex_update_term( $taxonomy, $term_data ) {
5815
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5816
-		return false;
5817
-	}
5815
+    if ( empty( $taxonomy ) || empty( $term_data ) ) {
5816
+        return false;
5817
+    }
5818 5818
 	
5819
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5820
-	$term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
5819
+    $term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5820
+    $term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
5821 5821
 	
5822
-	$args = array();
5823
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5824
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5825
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5822
+    $args = array();
5823
+    $args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5824
+    $args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5825
+    $args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5826 5826
 	
5827
-	if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
5828
-		$term_data['term_id'] = $term_info['term_id'];
5827
+    if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
5828
+        $term_data['term_id'] = $term_info['term_id'];
5829 5829
 		
5830
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5830
+        $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5831 5831
 		
5832
-		if( !is_wp_error( $result ) ) {
5832
+        if( !is_wp_error( $result ) ) {
5833 5833
             return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5834 5834
         }
5835
-	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5836
-		$term_data['term_id'] = $term_info['term_id'];
5835
+    } else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5836
+        $term_data['term_id'] = $term_info['term_id'];
5837 5837
 		
5838
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5838
+        $result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5839 5839
 		
5840
-		if( !is_wp_error( $result ) ) {
5840
+        if( !is_wp_error( $result ) ) {
5841 5841
             return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5842 5842
         }
5843
-	} else {
5844
-		return geodir_imex_insert_term( $taxonomy, $term_data );
5845
-	}
5843
+    } else {
5844
+        return geodir_imex_insert_term( $taxonomy, $term_data );
5845
+    }
5846 5846
 	
5847
-	return false;
5847
+    return false;
5848 5848
 }
5849 5849
 
5850 5850
 /**
@@ -5857,21 +5857,21 @@  discard block
 block discarded – undo
5857 5857
  * @return int Posts count.
5858 5858
  */
5859 5859
 function geodir_get_posts_count( $post_type ) {
5860
-	$posts_count = wp_count_posts( $post_type );
5861
-	$posts_count = array_sum( (array)$posts_count );
5860
+    $posts_count = wp_count_posts( $post_type );
5861
+    $posts_count = array_sum( (array)$posts_count );
5862 5862
 	
5863
-	/**
5864
-	 * Modify returned post counts for the current post type.
5865
-	 *
5866
-	 * @since 1.4.6
5863
+    /**
5864
+     * Modify returned post counts for the current post type.
5865
+     *
5866
+     * @since 1.4.6
5867 5867
      * @package GeoDirectory
5868
-	 *
5869
-	 * @param int $posts_count Post counts.
5870
-	 * @param string $post_type Post type.
5871
-	 */
5872
-	$posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );	 
5868
+     *
5869
+     * @param int $posts_count Post counts.
5870
+     * @param string $post_type Post type.
5871
+     */
5872
+    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );	 
5873 5873
 	
5874
-	return $posts_count;
5874
+    return $posts_count;
5875 5875
 }
5876 5876
 
5877 5877
 /**
@@ -5888,18 +5888,18 @@  discard block
 block discarded – undo
5888 5888
  * @return int Posts count.
5889 5889
  */
5890 5890
 function geodir_imex_count_events( $posts_count, $post_type ) {
5891
-	if ( $post_type == 'gd_event' ) {
5892
-		global $wpdb, $plugin_prefix;
5891
+    if ( $post_type == 'gd_event' ) {
5892
+        global $wpdb, $plugin_prefix;
5893 5893
 		
5894
-		$table = $plugin_prefix . $post_type . '_detail';
5895
-		$schedule_table = EVENT_SCHEDULE;
5894
+        $table = $plugin_prefix . $post_type . '_detail';
5895
+        $schedule_table = EVENT_SCHEDULE;
5896 5896
 
5897
-		$query = "SELECT COUNT({$wpdb->posts}.ID) AS total FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s";
5897
+        $query = "SELECT COUNT({$wpdb->posts}.ID) AS total FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s";
5898 5898
 		
5899
-		$posts_count = (int)$wpdb->get_var( $wpdb->prepare( $query, $post_type ) );
5900
-	}
5899
+        $posts_count = (int)$wpdb->get_var( $wpdb->prepare( $query, $post_type ) );
5900
+    }
5901 5901
 	
5902
-	return $posts_count;
5902
+    return $posts_count;
5903 5903
 }
5904 5904
 
5905 5905
 /**
@@ -5919,290 +5919,290 @@  discard block
 block discarded – undo
5919 5919
  * @return array Array of posts data.
5920 5920
  */
5921 5921
 function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {	
5922
-	global $wp_filesystem;
5922
+    global $wp_filesystem;
5923 5923
 
5924
-	$posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5924
+    $posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5925 5925
 
5926
-	$csv_rows = array();
5926
+    $csv_rows = array();
5927 5927
 	
5928
-	if ( !empty( $posts ) ) {
5929
-		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5928
+    if ( !empty( $posts ) ) {
5929
+        $is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5930 5930
 		
5931
-		$csv_row = array();
5932
-		$csv_row[] = 'post_id';
5933
-		$csv_row[] = 'post_title';
5934
-		$csv_row[] = 'post_author';
5935
-		$csv_row[] = 'post_content';
5936
-		$csv_row[] = 'post_category';
5937
-		$csv_row[] = 'default_category';
5938
-		$csv_row[] = 'post_tags';
5939
-		$csv_row[] = 'post_type';
5940
-		if ( $post_type == 'gd_event' ) {
5941
-			$csv_row[] = 'event_date';
5942
-			$csv_row[] = 'event_enddate';
5943
-			$csv_row[] = 'starttime';
5944
-			$csv_row[] = 'endtime';
5931
+        $csv_row = array();
5932
+        $csv_row[] = 'post_id';
5933
+        $csv_row[] = 'post_title';
5934
+        $csv_row[] = 'post_author';
5935
+        $csv_row[] = 'post_content';
5936
+        $csv_row[] = 'post_category';
5937
+        $csv_row[] = 'default_category';
5938
+        $csv_row[] = 'post_tags';
5939
+        $csv_row[] = 'post_type';
5940
+        if ( $post_type == 'gd_event' ) {
5941
+            $csv_row[] = 'event_date';
5942
+            $csv_row[] = 'event_enddate';
5943
+            $csv_row[] = 'starttime';
5944
+            $csv_row[] = 'endtime';
5945 5945
 			
5946
-			$csv_row[] = 'is_recurring_event';
5947
-			$csv_row[] = 'event_duration_days';
5948
-			$csv_row[] = 'recurring_dates';
5949
-			$csv_row[] = 'is_whole_day_event';
5950
-			$csv_row[] = 'event_starttimes';
5951
-			$csv_row[] = 'event_endtimes';
5952
-			$csv_row[] = 'recurring_type';
5953
-			$csv_row[] = 'recurring_interval';
5954
-			$csv_row[] = 'recurring_week_days';
5955
-			$csv_row[] = 'recurring_week_nos';
5956
-			$csv_row[] = 'max_recurring_count';
5957
-			$csv_row[] = 'recurring_end_date';
5958
-		}
5959
-		$csv_row[] = 'post_status';
5960
-		$csv_row[] = 'is_featured';
5961
-		if ($is_payment_plugin) {
5962
-			$csv_row[] = 'package_id';
5963
-			$csv_row[] = 'expire_date';
5964
-		}
5965
-		$csv_row[] = 'geodir_video';
5966
-		$csv_row[] = 'post_address';
5967
-		$csv_row[] = 'post_city';
5968
-		$csv_row[] = 'post_region';
5969
-		$csv_row[] = 'post_country';
5970
-		$csv_row[] = 'post_zip';
5971
-		$csv_row[] = 'post_latitude';
5972
-		$csv_row[] = 'post_longitude';
5973
-		$csv_row[] = 'geodir_timing';
5974
-		$csv_row[] = 'geodir_contact';
5975
-		$csv_row[] = 'geodir_email';
5976
-		$csv_row[] = 'geodir_website';
5977
-		$csv_row[] = 'geodir_twitter';
5978
-		$csv_row[] = 'geodir_facebook';
5979
-		$csv_row[] = 'geodir_video';
5980
-		$csv_row[] = 'geodir_special_offers';
5981
-		// WPML
5982
-		$is_wpml = geodir_is_wpml();
5983
-		if ($is_wpml) {
5984
-			$csv_row[] = 'language';
5985
-			$csv_row[] = 'original_post_id';
5986
-		}
5987
-		// WPML
5946
+            $csv_row[] = 'is_recurring_event';
5947
+            $csv_row[] = 'event_duration_days';
5948
+            $csv_row[] = 'recurring_dates';
5949
+            $csv_row[] = 'is_whole_day_event';
5950
+            $csv_row[] = 'event_starttimes';
5951
+            $csv_row[] = 'event_endtimes';
5952
+            $csv_row[] = 'recurring_type';
5953
+            $csv_row[] = 'recurring_interval';
5954
+            $csv_row[] = 'recurring_week_days';
5955
+            $csv_row[] = 'recurring_week_nos';
5956
+            $csv_row[] = 'max_recurring_count';
5957
+            $csv_row[] = 'recurring_end_date';
5958
+        }
5959
+        $csv_row[] = 'post_status';
5960
+        $csv_row[] = 'is_featured';
5961
+        if ($is_payment_plugin) {
5962
+            $csv_row[] = 'package_id';
5963
+            $csv_row[] = 'expire_date';
5964
+        }
5965
+        $csv_row[] = 'geodir_video';
5966
+        $csv_row[] = 'post_address';
5967
+        $csv_row[] = 'post_city';
5968
+        $csv_row[] = 'post_region';
5969
+        $csv_row[] = 'post_country';
5970
+        $csv_row[] = 'post_zip';
5971
+        $csv_row[] = 'post_latitude';
5972
+        $csv_row[] = 'post_longitude';
5973
+        $csv_row[] = 'geodir_timing';
5974
+        $csv_row[] = 'geodir_contact';
5975
+        $csv_row[] = 'geodir_email';
5976
+        $csv_row[] = 'geodir_website';
5977
+        $csv_row[] = 'geodir_twitter';
5978
+        $csv_row[] = 'geodir_facebook';
5979
+        $csv_row[] = 'geodir_video';
5980
+        $csv_row[] = 'geodir_special_offers';
5981
+        // WPML
5982
+        $is_wpml = geodir_is_wpml();
5983
+        if ($is_wpml) {
5984
+            $csv_row[] = 'language';
5985
+            $csv_row[] = 'original_post_id';
5986
+        }
5987
+        // WPML
5988 5988
 
5989
-		$custom_fields = geodir_imex_get_custom_fields( $post_type );
5990
-		if ( !empty( $custom_fields ) ) {
5991
-			foreach ( $custom_fields as $custom_field ) {
5992
-				$csv_row[] = $custom_field->htmlvar_name;
5993
-			}
5994
-		}
5989
+        $custom_fields = geodir_imex_get_custom_fields( $post_type );
5990
+        if ( !empty( $custom_fields ) ) {
5991
+            foreach ( $custom_fields as $custom_field ) {
5992
+                $csv_row[] = $custom_field->htmlvar_name;
5993
+            }
5994
+        }
5995 5995
 
5996
-		// Export franchise fields
5997
-		$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5998
-		if ($is_franchise_active) {
5999
-			$csv_row[] = 'gd_is_franchise';
6000
-			$csv_row[] = 'gd_franchise_lock';
6001
-			$csv_row[] = 'franchise';
6002
-		}
5996
+        // Export franchise fields
5997
+        $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5998
+        if ($is_franchise_active) {
5999
+            $csv_row[] = 'gd_is_franchise';
6000
+            $csv_row[] = 'gd_franchise_lock';
6001
+            $csv_row[] = 'franchise';
6002
+        }
6003 6003
 		
6004
-		$csv_rows[] = $csv_row;
6004
+        $csv_rows[] = $csv_row;
6005 6005
 
6006
-		$images_count = 5;
6006
+        $images_count = 5;
6007 6007
         $xx=0;
6008
-		foreach ( $posts as $post ) {$xx++;
6009
-			$post_id = $post['ID'];
6008
+        foreach ( $posts as $post ) {$xx++;
6009
+            $post_id = $post['ID'];
6010 6010
 			
6011
-			$gd_post_info = geodir_get_post_info( $post_id );
6012
-			$post_info = (array)$gd_post_info;
6011
+            $gd_post_info = geodir_get_post_info( $post_id );
6012
+            $post_info = (array)$gd_post_info;
6013 6013
 						
6014
-			$taxonomy_category = $post_type . 'category';
6015
-			$taxonomy_tags = $post_type . '_tags';
6014
+            $taxonomy_category = $post_type . 'category';
6015
+            $taxonomy_tags = $post_type . '_tags';
6016 6016
 			
6017
-			$post_category = '';
6018
-			$default_category_id = $gd_post_info->default_category;
6019
-			$default_category = '';
6020
-			$post_tags = '';
6021
-			$terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
6017
+            $post_category = '';
6018
+            $default_category_id = $gd_post_info->default_category;
6019
+            $default_category = '';
6020
+            $post_tags = '';
6021
+            $terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
6022 6022
 			
6023
-			if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
6024
-				$post_category = array();
6025
-				$post_tags = array();
6023
+            if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
6024
+                $post_category = array();
6025
+                $post_tags = array();
6026 6026
 			
6027
-				foreach ( $terms as $term ) {
6028
-					if ( $term->taxonomy == $taxonomy_category ) {
6029
-						$post_category[] = $term->name;
6027
+                foreach ( $terms as $term ) {
6028
+                    if ( $term->taxonomy == $taxonomy_category ) {
6029
+                        $post_category[] = $term->name;
6030 6030
 						
6031
-						if ($default_category_id == $term->term_id) {
6032
-							$default_category = $term->name; // Default category.
6033
-						}
6034
-					}
6031
+                        if ($default_category_id == $term->term_id) {
6032
+                            $default_category = $term->name; // Default category.
6033
+                        }
6034
+                    }
6035 6035
 					
6036
-					if ( $term->taxonomy == $taxonomy_tags ) {
6037
-						$post_tags[] = $term->name;
6038
-					}
6039
-				}
6036
+                    if ( $term->taxonomy == $taxonomy_tags ) {
6037
+                        $post_tags[] = $term->name;
6038
+                    }
6039
+                }
6040 6040
 				
6041
-				if (empty($default_category) && !empty($post_category)) {
6042
-					$default_category = $post_category[0]; // Set first one as default category.
6043
-				}
6044
-				$post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
6045
-				$post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
6046
-			}
6041
+                if (empty($default_category) && !empty($post_category)) {
6042
+                    $default_category = $post_category[0]; // Set first one as default category.
6043
+                }
6044
+                $post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
6045
+                $post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
6046
+            }
6047 6047
 
6048
-			// Franchise data
6049
-			$franchise_id = NULL;
6050
-			$franchise_info = array();
6051
-			$locked_fields = array();
6048
+            // Franchise data
6049
+            $franchise_id = NULL;
6050
+            $franchise_info = array();
6051
+            $locked_fields = array();
6052 6052
 			
6053
-			if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
6054
-				$franchise_id = $post_info['franchise'];
6055
-				$gd_franchise_info = geodir_get_post_info($franchise_id);
6053
+            if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
6054
+                $franchise_id = $post_info['franchise'];
6055
+                $gd_franchise_info = geodir_get_post_info($franchise_id);
6056 6056
 
6057
-				if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
6058
-					$franchise_info = (array)$gd_franchise_info;
6059
-					$locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
6057
+                if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
6058
+                    $franchise_info = (array)$gd_franchise_info;
6059
+                    $locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
6060 6060
 					
6061
-					if (!empty($locked_fields)) {
6062
-						foreach( $locked_fields as $locked_field) {
6063
-							if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
6064
-								$post_info[$locked_field] = $franchise_info[$locked_field];
6065
-							}
6061
+                    if (!empty($locked_fields)) {
6062
+                        foreach( $locked_fields as $locked_field) {
6063
+                            if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
6064
+                                $post_info[$locked_field] = $franchise_info[$locked_field];
6065
+                            }
6066 6066
 							
6067
-							if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
6068
-								$franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
6067
+                            if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
6068
+                                $franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
6069 6069
 			
6070
-								if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
6071
-									$franchise_post_category = array();
6072
-									$franchise_post_tags = array();
6070
+                                if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
6071
+                                    $franchise_post_category = array();
6072
+                                    $franchise_post_tags = array();
6073 6073
 								
6074
-									foreach ( $franchise_terms as $franchise_term ) {
6075
-										if ( $franchise_term->taxonomy == $taxonomy_category ) {
6076
-											$franchise_post_category[] = $franchise_term->name;
6077
-										}
6074
+                                    foreach ( $franchise_terms as $franchise_term ) {
6075
+                                        if ( $franchise_term->taxonomy == $taxonomy_category ) {
6076
+                                            $franchise_post_category[] = $franchise_term->name;
6077
+                                        }
6078 6078
 										
6079
-										if ( $franchise_term->taxonomy == $taxonomy_tags ) {
6080
-											$franchise_post_tags[] = $franchise_term->name;
6081
-										}
6082
-									}
6079
+                                        if ( $franchise_term->taxonomy == $taxonomy_tags ) {
6080
+                                            $franchise_post_tags[] = $franchise_term->name;
6081
+                                        }
6082
+                                    }
6083 6083
 									
6084
-									if (in_array($taxonomy_category, $locked_fields)) {
6085
-										$post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
6086
-									}
6087
-									if (in_array('post_tags', $locked_fields)) {
6088
-										$post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
6089
-									}
6090
-								}
6091
-							}
6092
-						}
6093
-					}
6094
-				}
6095
-			}
6084
+                                    if (in_array($taxonomy_category, $locked_fields)) {
6085
+                                        $post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
6086
+                                    }
6087
+                                    if (in_array('post_tags', $locked_fields)) {
6088
+                                        $post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
6089
+                                    }
6090
+                                }
6091
+                            }
6092
+                        }
6093
+                    }
6094
+                }
6095
+            }
6096 6096
 						
6097
-			$post_images = geodir_get_images( $post_id );
6098
-			$current_images = array();
6099
-			if ( !empty( $post_images ) ) {
6100
-				foreach ( $post_images as $post_image ) {
6101
-					$post_image = (array)$post_image;
6102
-					$image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
6103
-					if ( $image ) {
6104
-						$current_images[] = $image;
6105
-					}
6106
-				}
6097
+            $post_images = geodir_get_images( $post_id );
6098
+            $current_images = array();
6099
+            if ( !empty( $post_images ) ) {
6100
+                foreach ( $post_images as $post_image ) {
6101
+                    $post_image = (array)$post_image;
6102
+                    $image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
6103
+                    if ( $image ) {
6104
+                        $current_images[] = $image;
6105
+                    }
6106
+                }
6107 6107
 				
6108
-				$images_count = max( $images_count, count( $current_images ) );
6109
-			}
6108
+                $images_count = max( $images_count, count( $current_images ) );
6109
+            }
6110 6110
 
6111
-			$csv_row = array();
6112
-			$csv_row[] = $post_id; // post_id
6113
-			$csv_row[] = $post_info['post_title']; // post_title
6114
-			$csv_row[] = $post_info['post_author']; // post_author
6115
-			$csv_row[] = $post_info['post_content']; // post_content
6116
-			$csv_row[] = $post_category; // post_category
6117
-			$csv_row[] = $default_category; // default_category
6118
-			$csv_row[] = $post_tags; // post_tags
6119
-			$csv_row[] = $post_type; // post_type
6120
-			if ( $post_type == 'gd_event' ) {
6121
-				$event_data = geodir_imex_get_event_data($post, $gd_post_info);
6122
-				$csv_row[] = $event_data['event_date']; // event_date
6123
-				$csv_row[] = $event_data['event_enddate']; // enddate
6124
-				$csv_row[] = $event_data['starttime']; // starttime
6125
-				$csv_row[] = $event_data['endtime']; // endtime
6111
+            $csv_row = array();
6112
+            $csv_row[] = $post_id; // post_id
6113
+            $csv_row[] = $post_info['post_title']; // post_title
6114
+            $csv_row[] = $post_info['post_author']; // post_author
6115
+            $csv_row[] = $post_info['post_content']; // post_content
6116
+            $csv_row[] = $post_category; // post_category
6117
+            $csv_row[] = $default_category; // default_category
6118
+            $csv_row[] = $post_tags; // post_tags
6119
+            $csv_row[] = $post_type; // post_type
6120
+            if ( $post_type == 'gd_event' ) {
6121
+                $event_data = geodir_imex_get_event_data($post, $gd_post_info);
6122
+                $csv_row[] = $event_data['event_date']; // event_date
6123
+                $csv_row[] = $event_data['event_enddate']; // enddate
6124
+                $csv_row[] = $event_data['starttime']; // starttime
6125
+                $csv_row[] = $event_data['endtime']; // endtime
6126 6126
 				
6127
-				$csv_row[] = $event_data['is_recurring_event']; // is_recurring
6128
-				$csv_row[] = $event_data['event_duration_days']; // duration_x
6129
-				$csv_row[] = $event_data['recurring_dates']; // recurring_dates
6130
-				$csv_row[] = $event_data['is_whole_day_event']; // all_day
6131
-				$csv_row[] = $event_data['event_starttimes']; // starttimes
6132
-				$csv_row[] = $event_data['event_endtimes']; // endtimes
6133
-				$csv_row[] = $event_data['recurring_type']; // repeat_type
6134
-				$csv_row[] = $event_data['recurring_interval']; // repeat_x
6135
-				$csv_row[] = $event_data['recurring_week_days']; // repeat_days
6136
-				$csv_row[] = $event_data['recurring_week_nos']; // repeat_weeks
6137
-				$csv_row[] = $event_data['max_recurring_count']; // max_repeat
6138
-				$csv_row[] = $event_data['recurring_end_date']; // repeat_end
6139
-			}
6140
-			$csv_row[] = $post_info['post_status']; // post_status
6141
-			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
6142
-			if ($is_payment_plugin) {
6143
-				$csv_row[] = (int)$post_info['package_id']; // package_id
6144
-				$csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
6145
-			}
6146
-			$csv_row[] = $post_info['geodir_video']; // geodir_video
6147
-			$csv_row[] = $post_info['post_address']; // post_address
6148
-			$csv_row[] = $post_info['post_city']; // post_city
6149
-			$csv_row[] = $post_info['post_region']; // post_region
6150
-			$csv_row[] = $post_info['post_country']; // post_country
6151
-			$csv_row[] = $post_info['post_zip']; // post_zip
6152
-			$csv_row[] = $post_info['post_latitude']; // post_latitude
6153
-			$csv_row[] = $post_info['post_longitude']; // post_longitude
6154
-			$csv_row[] = $post_info['geodir_timing']; // geodir_timing
6155
-			$csv_row[] = $post_info['geodir_contact']; // geodir_contact
6156
-			$csv_row[] = $post_info['geodir_email']; // geodir_email
6157
-			$csv_row[] = $post_info['geodir_website']; // geodir_website
6158
-			$csv_row[] = $post_info['geodir_twitter']; // geodir_twitter
6159
-			$csv_row[] = $post_info['geodir_facebook']; // geodir_facebook
6160
-			$csv_row[] = $post_info['geodir_video']; // geodir_video
6161
-			$csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers
6162
-			// WPML
6163
-			if ($is_wpml) {
6164
-				$csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
6165
-				$csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
6166
-			}
6167
-			// WPML
6127
+                $csv_row[] = $event_data['is_recurring_event']; // is_recurring
6128
+                $csv_row[] = $event_data['event_duration_days']; // duration_x
6129
+                $csv_row[] = $event_data['recurring_dates']; // recurring_dates
6130
+                $csv_row[] = $event_data['is_whole_day_event']; // all_day
6131
+                $csv_row[] = $event_data['event_starttimes']; // starttimes
6132
+                $csv_row[] = $event_data['event_endtimes']; // endtimes
6133
+                $csv_row[] = $event_data['recurring_type']; // repeat_type
6134
+                $csv_row[] = $event_data['recurring_interval']; // repeat_x
6135
+                $csv_row[] = $event_data['recurring_week_days']; // repeat_days
6136
+                $csv_row[] = $event_data['recurring_week_nos']; // repeat_weeks
6137
+                $csv_row[] = $event_data['max_recurring_count']; // max_repeat
6138
+                $csv_row[] = $event_data['recurring_end_date']; // repeat_end
6139
+            }
6140
+            $csv_row[] = $post_info['post_status']; // post_status
6141
+            $csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
6142
+            if ($is_payment_plugin) {
6143
+                $csv_row[] = (int)$post_info['package_id']; // package_id
6144
+                $csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
6145
+            }
6146
+            $csv_row[] = $post_info['geodir_video']; // geodir_video
6147
+            $csv_row[] = $post_info['post_address']; // post_address
6148
+            $csv_row[] = $post_info['post_city']; // post_city
6149
+            $csv_row[] = $post_info['post_region']; // post_region
6150
+            $csv_row[] = $post_info['post_country']; // post_country
6151
+            $csv_row[] = $post_info['post_zip']; // post_zip
6152
+            $csv_row[] = $post_info['post_latitude']; // post_latitude
6153
+            $csv_row[] = $post_info['post_longitude']; // post_longitude
6154
+            $csv_row[] = $post_info['geodir_timing']; // geodir_timing
6155
+            $csv_row[] = $post_info['geodir_contact']; // geodir_contact
6156
+            $csv_row[] = $post_info['geodir_email']; // geodir_email
6157
+            $csv_row[] = $post_info['geodir_website']; // geodir_website
6158
+            $csv_row[] = $post_info['geodir_twitter']; // geodir_twitter
6159
+            $csv_row[] = $post_info['geodir_facebook']; // geodir_facebook
6160
+            $csv_row[] = $post_info['geodir_video']; // geodir_video
6161
+            $csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers
6162
+            // WPML
6163
+            if ($is_wpml) {
6164
+                $csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
6165
+                $csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
6166
+            }
6167
+            // WPML
6168 6168
 			
6169
-			if ( !empty( $custom_fields ) ) {
6170
-				foreach ( $custom_fields as $custom_field ) {
6171
-					$csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
6172
-				}
6173
-			}
6169
+            if ( !empty( $custom_fields ) ) {
6170
+                foreach ( $custom_fields as $custom_field ) {
6171
+                    $csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
6172
+                }
6173
+            }
6174 6174
 			
6175
-			// Franchise data
6176
-			if ($is_franchise_active) {
6177
-				$gd_is_franchise = '';
6178
-				$locaked_fields = '';
6179
-				$franchise = '';
6175
+            // Franchise data
6176
+            if ($is_franchise_active) {
6177
+                $gd_is_franchise = '';
6178
+                $locaked_fields = '';
6179
+                $franchise = '';
6180 6180
 					
6181
-				if (geodir_franchise_pkg_is_active($gd_post_info)) {
6182
-					$gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
6183
-					$locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
6184
-					$locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
6185
-					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
6186
-				}
6181
+                if (geodir_franchise_pkg_is_active($gd_post_info)) {
6182
+                    $gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
6183
+                    $locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
6184
+                    $locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
6185
+                    $franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
6186
+                }
6187 6187
 				
6188
-				$csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
6189
-				$csv_row[] = $locaked_fields; // gd_franchise_lock fields
6190
-				$csv_row[] = (int)$franchise; // franchise id
6191
-			}
6188
+                $csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
6189
+                $csv_row[] = $locaked_fields; // gd_franchise_lock fields
6190
+                $csv_row[] = (int)$franchise; // franchise id
6191
+            }
6192 6192
 			
6193
-			for ( $c = 0; $c < $images_count; $c++ ) {
6194
-				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
6195
-			}
6193
+            for ( $c = 0; $c < $images_count; $c++ ) {
6194
+                $csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
6195
+            }
6196 6196
 			
6197
-			$csv_rows[] = $csv_row;
6197
+            $csv_rows[] = $csv_row;
6198 6198
 
6199
-		}
6199
+        }
6200 6200
 
6201
-		for ( $c = 0; $c < $images_count; $c++ ) {
6202
-			$csv_rows[0][] = 'IMAGE';
6203
-		}
6204
-	}
6205
-	return $csv_rows;
6201
+        for ( $c = 0; $c < $images_count; $c++ ) {
6202
+            $csv_rows[0][] = 'IMAGE';
6203
+        }
6204
+    }
6205
+    return $csv_rows;
6206 6206
 }
6207 6207
 
6208 6208
 /**
@@ -6221,48 +6221,48 @@  discard block
 block discarded – undo
6221 6221
  * @return array Array of posts data.
6222 6222
  */
6223 6223
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
6224
-	global $wpdb, $plugin_prefix;
6224
+    global $wpdb, $plugin_prefix;
6225 6225
 
6226
-	if ( ! post_type_exists( $post_type ) )
6227
-		return new stdClass;
6226
+    if ( ! post_type_exists( $post_type ) )
6227
+        return new stdClass;
6228 6228
 		
6229
-	$table = $plugin_prefix . $post_type . '_detail';
6229
+    $table = $plugin_prefix . $post_type . '_detail';
6230 6230
 	
6231
-	$limit = '';
6232
-	if ( $per_page > 0 && $page_no > 0 ) {
6233
-		$offset = ( $page_no - 1 ) * $per_page;
6231
+    $limit = '';
6232
+    if ( $per_page > 0 && $page_no > 0 ) {
6233
+        $offset = ( $page_no - 1 ) * $per_page;
6234 6234
 		
6235
-		if ( $offset > 0 ) {
6236
-			$limit = " LIMIT " . $offset . "," . $per_page;
6237
-		} else {
6238
-			$limit = " LIMIT " . $per_page;
6239
-		}
6240
-	}
6235
+        if ( $offset > 0 ) {
6236
+            $limit = " LIMIT " . $offset . "," . $per_page;
6237
+        } else {
6238
+            $limit = " LIMIT " . $per_page;
6239
+        }
6240
+    }
6241 6241
 
6242
-	$query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ORDER BY {$wpdb->posts}.ID ASC" . $limit;
6243
-	/**
6244
-	 * Modify returned posts SQL query for the current post type.
6245
-	 *
6246
-	 * @since 1.4.6
6242
+    $query = "SELECT {$wpdb->posts}.ID FROM {$wpdb->posts} INNER JOIN {$table} ON {$table}.post_id = {$wpdb->posts}.ID WHERE {$wpdb->posts}.post_type = %s ORDER BY {$wpdb->posts}.ID ASC" . $limit;
6243
+    /**
6244
+     * Modify returned posts SQL query for the current post type.
6245
+     *
6246
+     * @since 1.4.6
6247 6247
      * @package GeoDirectory
6248
-	 *
6249
-	 * @param int $query The SQL query.
6250
-	 * @param string $post_type Post type.
6251
-	 */
6252
-	$query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
6253
-
6254
-	$results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
6255
-
6256
-	/**
6257
-	 * Modify returned post results for the current post type.
6258
-	 *
6259
-	 * @since 1.4.6
6248
+     *
6249
+     * @param int $query The SQL query.
6250
+     * @param string $post_type Post type.
6251
+     */
6252
+    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
6253
+
6254
+    $results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
6255
+
6256
+    /**
6257
+     * Modify returned post results for the current post type.
6258
+     *
6259
+     * @since 1.4.6
6260 6260
      * @package GeoDirectory
6261
-	 *
6262
-	 * @param object $results An object containing all post ids.
6263
-	 * @param string $post_type Post type.
6264
-	 */
6265
-	return apply_filters( 'geodir_export_posts', $results, $post_type );
6261
+     *
6262
+     * @param object $results An object containing all post ids.
6263
+     * @param string $post_type Post type.
6264
+     */
6265
+    return apply_filters( 'geodir_export_posts', $results, $post_type );
6266 6266
 }
6267 6267
 
6268 6268
 /**
@@ -6280,16 +6280,16 @@  discard block
 block discarded – undo
6280 6280
  * @return string The SQL query.
6281 6281
  */
6282 6282
 function geodir_imex_get_events_query( $query, $post_type ) {
6283
-	if ( $post_type == 'gd_event' ) {
6284
-		global $wpdb, $plugin_prefix;
6283
+    if ( $post_type == 'gd_event' ) {
6284
+        global $wpdb, $plugin_prefix;
6285 6285
 		
6286
-		$table = $plugin_prefix . $post_type . '_detail';
6287
-		$schedule_table = EVENT_SCHEDULE;
6286
+        $table = $plugin_prefix . $post_type . '_detail';
6287
+        $schedule_table = EVENT_SCHEDULE;
6288 6288
 
6289
-		$query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
6290
-	}
6289
+        $query = "SELECT {$wpdb->posts}.ID, {$schedule_table}.event_date, {$schedule_table}.event_enddate AS enddate, {$schedule_table}.event_starttime AS starttime, {$schedule_table}.event_endtime AS endtime FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s GROUP BY {$table}.post_id ORDER BY {$wpdb->posts}.ID ASC, {$schedule_table}.schedule_id ASC";
6290
+    }
6291 6291
 	
6292
-	return $query; 
6292
+    return $query; 
6293 6293
 }
6294 6294
 
6295 6295
 /**
@@ -6302,16 +6302,16 @@  discard block
 block discarded – undo
6302 6302
  * @return int Total terms count.
6303 6303
  */
6304 6304
 function geodir_get_terms_count( $post_type ) {
6305
-	$args = array( 'hide_empty' => 0 );
6305
+    $args = array( 'hide_empty' => 0 );
6306 6306
 	
6307
-	remove_all_filters( 'get_terms' );
6307
+    remove_all_filters( 'get_terms' );
6308 6308
 	
6309
-	$taxonomy = $post_type . 'category';
6309
+    $taxonomy = $post_type . 'category';
6310 6310
 
6311
-	$count_terms = wp_count_terms( $taxonomy, $args );
6312
-	$count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
6311
+    $count_terms = wp_count_terms( $taxonomy, $args );
6312
+    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
6313 6313
 	 
6314
-	return $count_terms;
6314
+    return $count_terms;
6315 6315
 }
6316 6316
 
6317 6317
 /**
@@ -6327,76 +6327,76 @@  discard block
 block discarded – undo
6327 6327
  * @return array Array of terms data.
6328 6328
  */
6329 6329
 function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
6330
-	$args = array( 'hide_empty' => 0, 'orderby' => 'id' );
6330
+    $args = array( 'hide_empty' => 0, 'orderby' => 'id' );
6331 6331
 	
6332
-	remove_all_filters( 'get_terms' );
6332
+    remove_all_filters( 'get_terms' );
6333 6333
 	
6334
-	$taxonomy = $post_type . 'category';
6334
+    $taxonomy = $post_type . 'category';
6335 6335
 	
6336
-	if ( $per_page > 0 && $page_no > 0 ) {
6337
-		$args['offset'] = ( $page_no - 1 ) * $per_page;
6338
-		$args['number'] = $per_page;
6339
-	}
6336
+    if ( $per_page > 0 && $page_no > 0 ) {
6337
+        $args['offset'] = ( $page_no - 1 ) * $per_page;
6338
+        $args['number'] = $per_page;
6339
+    }
6340 6340
 	
6341
-	$terms = get_terms( $taxonomy, $args );
6341
+    $terms = get_terms( $taxonomy, $args );
6342 6342
 
6343
-	$csv_rows = array();
6343
+    $csv_rows = array();
6344 6344
 	
6345
-	if ( !empty( $terms ) ) {
6346
-		$csv_row = array();
6347
-		$csv_row[] = 'cat_id';
6348
-		$csv_row[] = 'cat_name';
6349
-		$csv_row[] = 'cat_slug';
6350
-		$csv_row[] = 'cat_posttype';
6351
-		$csv_row[] = 'cat_parent';
6352
-		$csv_row[] = 'cat_schema';
6353
-		$csv_row[] = 'cat_description';
6354
-		$csv_row[] = 'cat_top_description';
6355
-		$csv_row[] = 'cat_image';
6356
-		$csv_row[] = 'cat_icon';
6357
-		// WPML
6358
-		$is_wpml = geodir_is_wpml();
6359
-		if ($is_wpml) {
6360
-			$csv_row[] = 'cat_language';
6361
-		}
6362
-		// WPML
6345
+    if ( !empty( $terms ) ) {
6346
+        $csv_row = array();
6347
+        $csv_row[] = 'cat_id';
6348
+        $csv_row[] = 'cat_name';
6349
+        $csv_row[] = 'cat_slug';
6350
+        $csv_row[] = 'cat_posttype';
6351
+        $csv_row[] = 'cat_parent';
6352
+        $csv_row[] = 'cat_schema';
6353
+        $csv_row[] = 'cat_description';
6354
+        $csv_row[] = 'cat_top_description';
6355
+        $csv_row[] = 'cat_image';
6356
+        $csv_row[] = 'cat_icon';
6357
+        // WPML
6358
+        $is_wpml = geodir_is_wpml();
6359
+        if ($is_wpml) {
6360
+            $csv_row[] = 'cat_language';
6361
+        }
6362
+        // WPML
6363 6363
 		
6364
-		$csv_rows[] = $csv_row;
6364
+        $csv_rows[] = $csv_row;
6365 6365
 		
6366
-		foreach ( $terms as $term ) {			
6367
-			$cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
6368
-			$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
6366
+        foreach ( $terms as $term ) {			
6367
+            $cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
6368
+            $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
6369 6369
 			
6370
-			$cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
6371
-			$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
6370
+            $cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
6371
+            $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
6372 6372
 			
6373
-			$cat_parent = '';
6374
-			if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
6375
-				$parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
6376
-				$cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
6377
-			}
6373
+            $cat_parent = '';
6374
+            if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
6375
+                $parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
6376
+                $cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
6377
+            }
6378 6378
 			
6379
-			$csv_row = array();
6380
-			$csv_row[] = $term->term_id;
6381
-			$csv_row[] = $term->name;
6382
-			$csv_row[] = $term->slug;
6383
-			$csv_row[] = $post_type;
6384
-			$csv_row[] = $cat_parent;
6385
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
6386
-			$csv_row[] = $term->description;
6387
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
6388
-			$csv_row[] = $cat_image;
6389
-			$csv_row[] = $cat_icon;
6390
-			// WPML
6391
-			if ($is_wpml) {
6392
-				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
6393
-			}
6394
-			// WPML
6379
+            $csv_row = array();
6380
+            $csv_row[] = $term->term_id;
6381
+            $csv_row[] = $term->name;
6382
+            $csv_row[] = $term->slug;
6383
+            $csv_row[] = $post_type;
6384
+            $csv_row[] = $cat_parent;
6385
+            $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
6386
+            $csv_row[] = $term->description;
6387
+            $csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
6388
+            $csv_row[] = $cat_image;
6389
+            $csv_row[] = $cat_icon;
6390
+            // WPML
6391
+            if ($is_wpml) {
6392
+                $csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
6393
+            }
6394
+            // WPML
6395 6395
 			
6396
-			$csv_rows[] = $csv_row;
6397
-		}
6398
-	}
6399
-	return $csv_rows;
6396
+            $csv_rows[] = $csv_row;
6397
+        }
6398
+    }
6399
+    return $csv_rows;
6400 6400
 }
6401 6401
 
6402 6402
 /**
@@ -6409,9 +6409,9 @@  discard block
 block discarded – undo
6409 6409
  * @return string Path to the cache directory.
6410 6410
  */
6411 6411
 function geodir_path_import_export( $relative = true ) {
6412
-	$upload_dir = wp_upload_dir();
6412
+    $upload_dir = wp_upload_dir();
6413 6413
 	
6414
-	return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
6414
+    return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
6415 6415
 }
6416 6416
 
6417 6417
 /**
@@ -6428,29 +6428,29 @@  discard block
 block discarded – undo
6428 6428
  * @return bool true if success otherwise false.
6429 6429
  */
6430 6430
 function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
6431
-	if ( empty( $csv_data ) ) {
6432
-		return false;
6433
-	}
6431
+    if ( empty( $csv_data ) ) {
6432
+        return false;
6433
+    }
6434 6434
 	
6435
-	global $wp_filesystem;
6435
+    global $wp_filesystem;
6436 6436
 	
6437
-	$mode = $clear ? 'w+' : 'a+';
6437
+    $mode = $clear ? 'w+' : 'a+';
6438 6438
 	
6439
-	if ( function_exists( 'fputcsv' ) ) {
6440
-		$file = fopen( $file_path, $mode );
6441
-		foreach( $csv_data as $csv_row ) {
6442
-			//$csv_row = array_map( 'utf8_decode', $csv_row );
6443
-			$write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
6444
-		}
6445
-		fclose( $file );
6446
-	} else {
6447
-		foreach( $csv_data as $csv_row ) {
6448
-			//$csv_row = array_map( 'utf8_decode', $csv_row );
6449
-			$wp_filesystem->put_contents( $file_path, $csv_row );
6450
-		}
6451
-	}
6439
+    if ( function_exists( 'fputcsv' ) ) {
6440
+        $file = fopen( $file_path, $mode );
6441
+        foreach( $csv_data as $csv_row ) {
6442
+            //$csv_row = array_map( 'utf8_decode', $csv_row );
6443
+            $write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
6444
+        }
6445
+        fclose( $file );
6446
+    } else {
6447
+        foreach( $csv_data as $csv_row ) {
6448
+            //$csv_row = array_map( 'utf8_decode', $csv_row );
6449
+            $wp_filesystem->put_contents( $file_path, $csv_row );
6450
+        }
6451
+    }
6452 6452
 		
6453
-	return true;
6453
+    return true;
6454 6454
 }
6455 6455
 
6456 6456
 /**
@@ -6465,17 +6465,17 @@  discard block
 block discarded – undo
6465 6465
  * @return int No of file rows.
6466 6466
  */
6467 6467
 function geodir_import_export_line_count( $file ) {
6468
-	global $wp_filesystem;
6468
+    global $wp_filesystem;
6469 6469
 	
6470
-	if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
6471
-		$contents = $wp_filesystem->get_contents_array( $file );
6470
+    if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
6471
+        $contents = $wp_filesystem->get_contents_array( $file );
6472 6472
 		
6473
-		if ( !empty( $contents ) && is_array( $contents ) ) {
6474
-			return count( $contents ) - 1;
6475
-		}
6476
-	}
6473
+        if ( !empty( $contents ) && is_array( $contents ) ) {
6474
+            return count( $contents ) - 1;
6475
+        }
6476
+    }
6477 6477
 	
6478
-	return NULL;
6478
+    return NULL;
6479 6479
 }
6480 6480
 
6481 6481
 /**
@@ -6489,12 +6489,12 @@  discard block
 block discarded – undo
6489 6489
  * @return object Queried object.
6490 6490
  */
6491 6491
 function geodir_imex_get_custom_fields( $post_type ) {
6492
-	global $wpdb;
6492
+    global $wpdb;
6493 6493
 	 
6494
-	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) );
6495
-	$rows = $wpdb->get_results( $sql );
6494
+    $sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) );
6495
+    $rows = $wpdb->get_results( $sql );
6496 6496
 	 
6497
-	return $rows;
6497
+    return $rows;
6498 6498
 }
6499 6499
 
6500 6500
 /**
@@ -6505,11 +6505,11 @@  discard block
 block discarded – undo
6505 6505
  * @return True if WPML is active else False.
6506 6506
  */
6507 6507
 function geodir_is_wpml() {
6508
-	if (function_exists('icl_object_id')) {
6509
-		return true;
6510
-	}
6508
+    if (function_exists('icl_object_id')) {
6509
+        return true;
6510
+    }
6511 6511
 	
6512
-	return false;
6512
+    return false;
6513 6513
 }
6514 6514
 
6515 6515
 /**
@@ -6524,9 +6524,9 @@  discard block
 block discarded – undo
6524 6524
  * @return Language code.
6525 6525
  */
6526 6526
 function geodir_get_language_for_element($element_id, $element_type) {
6527
-	global $sitepress;
6527
+    global $sitepress;
6528 6528
 	
6529
-	return $sitepress->get_language_for_element($element_id, $element_type);
6529
+    return $sitepress->get_language_for_element($element_id, $element_type);
6530 6530
 }
6531 6531
 
6532 6532
 /**
@@ -6540,18 +6540,18 @@  discard block
 block discarded – undo
6540 6540
  * @param int $tr_post_id Translation Post ID.
6541 6541
  */
6542 6542
 function geodir_icl_make_duplicate($master_post_id, $lang, $postarr, $tr_post_id) {
6543
-	$post_type = get_post_type($master_post_id);
6543
+    $post_type = get_post_type($master_post_id);
6544 6544
 
6545
-	if (in_array($post_type, geodir_get_posttypes())) {				
6546
-		// Duplicate post details
6547
-		geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang);
6545
+    if (in_array($post_type, geodir_get_posttypes())) {				
6546
+        // Duplicate post details
6547
+        geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang);
6548 6548
 		
6549
-		// Duplicate taxonomies
6550
-		geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang);
6549
+        // Duplicate taxonomies
6550
+        geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang);
6551 6551
 		
6552
-		// Duplicate post images
6553
-		geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang);
6554
-	}
6552
+        // Duplicate post images
6553
+        geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang);
6554
+    }
6555 6555
 }
6556 6556
 
6557 6557
 /**
@@ -6568,23 +6568,23 @@  discard block
 block discarded – undo
6568 6568
  * @return bool True for success, False for fail.
6569 6569
  */
6570 6570
 function geodir_icl_duplicate_post_details($master_post_id, $tr_post_id, $lang) {
6571
-	global $wpdb, $plugin_prefix;
6571
+    global $wpdb, $plugin_prefix;
6572 6572
 	
6573
-	$post_type = get_post_type($master_post_id);
6574
-	$post_table = $plugin_prefix . $post_type . '_detail';
6573
+    $post_type = get_post_type($master_post_id);
6574
+    $post_table = $plugin_prefix . $post_type . '_detail';
6575 6575
 	
6576
-	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
6577
-	$data = (array)$wpdb->get_row($query);
6576
+    $query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
6577
+    $data = (array)$wpdb->get_row($query);
6578 6578
 	
6579
-	if ( !empty( $data ) ) {
6580
-		$data['post_id'] = $tr_post_id;
6581
-		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
6579
+    if ( !empty( $data ) ) {
6580
+        $data['post_id'] = $tr_post_id;
6581
+        unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
6582 6582
 		
6583
-		$wpdb->update($post_table, $data, array('post_id' => $tr_post_id));		
6584
-		return true;
6585
-	}
6583
+        $wpdb->update($post_table, $data, array('post_id' => $tr_post_id));		
6584
+        return true;
6585
+    }
6586 6586
 	
6587
-	return false;
6587
+    return false;
6588 6588
 }
6589 6589
 
6590 6590
 /**
@@ -6601,40 +6601,40 @@  discard block
 block discarded – undo
6601 6601
  * @return bool True for success, False for fail.
6602 6602
  */
6603 6603
 function geodir_icl_duplicate_taxonomies($master_post_id, $tr_post_id, $lang) {
6604
-	global $sitepress, $wpdb;
6605
-	$post_type = get_post_type($master_post_id);
6604
+    global $sitepress, $wpdb;
6605
+    $post_type = get_post_type($master_post_id);
6606 6606
 	
6607
-	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
6607
+    remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
6608 6608
 
6609
-	$taxonomies = get_object_taxonomies($post_type);
6610
-	foreach ($taxonomies as $taxonomy) {
6611
-		$terms = get_the_terms($master_post_id, $taxonomy);
6612
-		$terms_array = array();
6609
+    $taxonomies = get_object_taxonomies($post_type);
6610
+    foreach ($taxonomies as $taxonomy) {
6611
+        $terms = get_the_terms($master_post_id, $taxonomy);
6612
+        $terms_array = array();
6613 6613
 		
6614
-		if ($terms) {
6615
-			foreach ($terms as $term) {
6616
-				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
6614
+        if ($terms) {
6615
+            foreach ($terms as $term) {
6616
+                $tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
6617 6617
 				
6618
-				if (!is_null($tr_id)){
6619
-					// not using get_term - unfiltered get_term
6620
-					$translated_term = $wpdb->get_row($wpdb->prepare("
6618
+                if (!is_null($tr_id)){
6619
+                    // not using get_term - unfiltered get_term
6620
+                    $translated_term = $wpdb->get_row($wpdb->prepare("
6621 6621
 						SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
6622 6622
 
6623
-					$terms_array[] = $translated_term->term_id;
6624
-				}
6625
-			}
6623
+                    $terms_array[] = $translated_term->term_id;
6624
+                }
6625
+            }
6626 6626
 
6627
-			if (!is_taxonomy_hierarchical($taxonomy)){
6628
-				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
6629
-			}
6627
+            if (!is_taxonomy_hierarchical($taxonomy)){
6628
+                $terms_array = array_unique( array_map( 'intval', $terms_array ) );
6629
+            }
6630 6630
 
6631
-			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
6631
+            wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
6632 6632
 			
6633
-			if ($taxonomy == $post_type . 'category') {
6634
-				geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
6635
-			}
6636
-		}
6637
-	}
6633
+            if ($taxonomy == $post_type . 'category') {
6634
+                geodir_set_postcat_structure($tr_post_id, $post_type . 'category');
6635
+            }
6636
+        }
6637
+    }
6638 6638
 }
6639 6639
 
6640 6640
 /**
@@ -6650,29 +6650,29 @@  discard block
 block discarded – undo
6650 6650
  * @return bool True for success, False for fail.
6651 6651
  */
6652 6652
 function geodir_icl_duplicate_post_images($master_post_id, $tr_post_id, $lang) {
6653
-	global $wpdb;
6653
+    global $wpdb;
6654 6654
 	
6655
-	$query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
6656
-	$wpdb->query($query);
6655
+    $query = $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d", array('%image%', $tr_post_id));
6656
+    $wpdb->query($query);
6657 6657
 	
6658
-	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
6659
-	$post_images = $wpdb->get_results($query);
6658
+    $query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
6659
+    $post_images = $wpdb->get_results($query);
6660 6660
 	
6661
-	if ( !empty( $post_images ) ) {
6662
-		foreach ( $post_images as $post_image) {
6663
-			$image_data = (array)$post_image;
6664
-			unset($image_data['ID']);
6665
-			$image_data['post_id'] = $tr_post_id;
6661
+    if ( !empty( $post_images ) ) {
6662
+        foreach ( $post_images as $post_image) {
6663
+            $image_data = (array)$post_image;
6664
+            unset($image_data['ID']);
6665
+            $image_data['post_id'] = $tr_post_id;
6666 6666
 			
6667
-			$wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data);
6667
+            $wpdb->insert(GEODIR_ATTACHMENT_TABLE, $image_data);
6668 6668
 			
6669
-			geodir_set_wp_featured_image($tr_post_id);
6670
-		}
6669
+            geodir_set_wp_featured_image($tr_post_id);
6670
+        }
6671 6671
 		
6672
-		return true;
6673
-	}
6672
+        return true;
6673
+    }
6674 6674
 	
6675
-	return false;
6675
+    return false;
6676 6676
 }
6677 6677
 
6678 6678
 /**
@@ -6686,141 +6686,141 @@  discard block
 block discarded – undo
6686 6686
  * @return array Event data array.
6687 6687
  */
6688 6688
 function geodir_imex_get_event_data($post, $gd_post_info) {
6689
-	$event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : '';
6690
-	$event_enddate = $event_date;
6691
-	$starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
6692
-	$endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
6689
+    $event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : '';
6690
+    $event_enddate = $event_date;
6691
+    $starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
6692
+    $endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
6693 6693
 	
6694
-	$is_recurring_event = '';
6695
-	$event_duration_days = '';
6696
-	$is_whole_day_event = '';
6697
-	$recurring_dates = '';
6698
-	$event_starttimes = '';
6699
-	$event_endtimes = '';
6700
-	$recurring_type = '';
6701
-	$recurring_interval = '';
6702
-	$recurring_week_days = '';
6703
-	$recurring_week_nos = '';
6704
-	$max_recurring_count = '';
6705
-	$recurring_end_date = '';
6706
-	$recurring_dates = '';
6694
+    $is_recurring_event = '';
6695
+    $event_duration_days = '';
6696
+    $is_whole_day_event = '';
6697
+    $recurring_dates = '';
6698
+    $event_starttimes = '';
6699
+    $event_endtimes = '';
6700
+    $recurring_type = '';
6701
+    $recurring_interval = '';
6702
+    $recurring_week_days = '';
6703
+    $recurring_week_nos = '';
6704
+    $max_recurring_count = '';
6705
+    $recurring_end_date = '';
6706
+    $recurring_dates = '';
6707 6707
 		
6708
-	$recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
6709
-	if (!empty($recurring_data)) {
6710
-		$event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date;
6711
-		$event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date;
6712
-		$starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
6713
-		$endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
6714
-		$is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
6715
-		$different_times = !empty($recurring_data['different_times']) ? true : false;
6708
+    $recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
6709
+    if (!empty($recurring_data)) {
6710
+        $event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date;
6711
+        $event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date;
6712
+        $starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
6713
+        $endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
6714
+        $is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
6715
+        $different_times = !empty($recurring_data['different_times']) ? true : false;
6716 6716
 	
6717
-		$recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
6718
-		$is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
6717
+        $recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
6718
+        $is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
6719 6719
 			
6720
-		if ($recurring_pkg && $is_recurring) {
6721
-			$recurring_dates = $event_date;
6722
-			$event_enddate = '';
6723
-			$is_recurring_event = 1;
6720
+        if ($recurring_pkg && $is_recurring) {
6721
+            $recurring_dates = $event_date;
6722
+            $event_enddate = '';
6723
+            $is_recurring_event = 1;
6724 6724
 						
6725
-			$recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
6725
+            $recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
6726 6726
 			
6727
-			if (!empty($recurring_data['event_recurring_dates'])) {
6728
-				$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
6727
+            if (!empty($recurring_data['event_recurring_dates'])) {
6728
+                $event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
6729 6729
 				
6730
-				if (!empty($event_recurring_dates)) {
6731
-					$recurring_dates = array();
6730
+                if (!empty($event_recurring_dates)) {
6731
+                    $recurring_dates = array();
6732 6732
 					
6733
-					foreach ($event_recurring_dates as $date) {
6734
-						$recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
6735
-					}
6733
+                    foreach ($event_recurring_dates as $date) {
6734
+                        $recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
6735
+                    }
6736 6736
 					
6737
-					$recurring_dates = implode(",", $recurring_dates);
6738
-				}
6739
-			}
6737
+                    $recurring_dates = implode(",", $recurring_dates);
6738
+                }
6739
+            }
6740 6740
 			
6741
-			if ($recurring_type == 'custom') {
6742
-				if (!$is_whole_day_event) {
6743
-					$event_starttimes = $starttime;
6744
-					$event_endtimes = $endtime;
6741
+            if ($recurring_type == 'custom') {
6742
+                if (!$is_whole_day_event) {
6743
+                    $event_starttimes = $starttime;
6744
+                    $event_endtimes = $endtime;
6745 6745
 			
6746
-					if (!empty($recurring_data['starttimes'])) {
6747
-						$times = array();
6746
+                    if (!empty($recurring_data['starttimes'])) {
6747
+                        $times = array();
6748 6748
 						
6749
-						foreach ($recurring_data['starttimes'] as $time) {
6750
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6751
-						}
6749
+                        foreach ($recurring_data['starttimes'] as $time) {
6750
+                            $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6751
+                        }
6752 6752
 						
6753
-						$event_starttimes = implode(",", $times);
6754
-					}
6753
+                        $event_starttimes = implode(",", $times);
6754
+                    }
6755 6755
 					
6756
-					if (!empty($recurring_data['endtimes'])) {
6757
-						$times = array();
6756
+                    if (!empty($recurring_data['endtimes'])) {
6757
+                        $times = array();
6758 6758
 						
6759
-						foreach ($recurring_data['endtimes'] as $time) {
6760
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6761
-						}
6759
+                        foreach ($recurring_data['endtimes'] as $time) {
6760
+                            $times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6761
+                        }
6762 6762
 						
6763
-						$event_endtimes = implode(",", $times);
6764
-					}
6763
+                        $event_endtimes = implode(",", $times);
6764
+                    }
6765 6765
 					
6766
-					if (!$different_times) {
6767
-						$event_starttimes = '';
6768
-						$event_endtimes = '';
6769
-					}
6770
-				}
6771
-			} else {
6772
-				$event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
6773
-				$recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6766
+                    if (!$different_times) {
6767
+                        $event_starttimes = '';
6768
+                        $event_endtimes = '';
6769
+                    }
6770
+                }
6771
+            } else {
6772
+                $event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
6773
+                $recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6774 6774
 				
6775
-				if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
6776
-					$week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
6775
+                if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
6776
+                    $week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
6777 6777
 					
6778
-					$days = array();
6779
-					foreach ($recurring_data['repeat_days'] as $day) {
6780
-						if (isset($week_days[$day])) {
6781
-							$days[] = $week_days[$day];
6782
-						}
6783
-					}
6778
+                    $days = array();
6779
+                    foreach ($recurring_data['repeat_days'] as $day) {
6780
+                        if (isset($week_days[$day])) {
6781
+                            $days[] = $week_days[$day];
6782
+                        }
6783
+                    }
6784 6784
 					
6785
-					$recurring_week_days = implode(",", array_unique($days));
6786
-				}
6785
+                    $recurring_week_days = implode(",", array_unique($days));
6786
+                }
6787 6787
 				
6788
-				$recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
6789
-				if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
6790
-					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : '';
6791
-					$max_recurring_count = empty($recurring_end_date) ? 1 : '';
6792
-				} else {
6793
-					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
6794
-				}
6795
-			}
6796
-		}
6797
-	}
6798
-	if ($is_whole_day_event) {
6799
-		$starttime = '';
6800
-		$endtime = '';
6801
-		$event_starttimes = '';
6802
-		$event_endtimes = '';
6803
-	}
6788
+                $recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
6789
+                if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
6790
+                    $recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : '';
6791
+                    $max_recurring_count = empty($recurring_end_date) ? 1 : '';
6792
+                } else {
6793
+                    $max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
6794
+                }
6795
+            }
6796
+        }
6797
+    }
6798
+    if ($is_whole_day_event) {
6799
+        $starttime = '';
6800
+        $endtime = '';
6801
+        $event_starttimes = '';
6802
+        $event_endtimes = '';
6803
+    }
6804 6804
 	
6805
-	$data = array();
6806
-	$data['event_date'] = $event_date;
6807
-	$data['event_enddate'] = $event_enddate;
6808
-	$data['starttime'] = $starttime;
6809
-	$data['endtime'] = $endtime;
6810
-	$data['is_recurring_event'] = $is_recurring_event;
6811
-	$data['recurring_dates'] = $recurring_dates;
6812
-	$data['event_duration_days'] = $event_duration_days;
6813
-	$data['is_whole_day_event'] = $is_whole_day_event;
6814
-	$data['event_starttimes'] = $event_starttimes;
6815
-	$data['event_endtimes'] = $event_endtimes;
6816
-	$data['recurring_type'] = $recurring_type;
6817
-	$data['recurring_interval'] = $recurring_interval;
6818
-	$data['recurring_week_days'] = $recurring_week_days;
6819
-	$data['recurring_week_nos'] = $recurring_week_nos;
6820
-	$data['max_recurring_count'] = $max_recurring_count;
6821
-	$data['recurring_end_date'] = $recurring_end_date;
6805
+    $data = array();
6806
+    $data['event_date'] = $event_date;
6807
+    $data['event_enddate'] = $event_enddate;
6808
+    $data['starttime'] = $starttime;
6809
+    $data['endtime'] = $endtime;
6810
+    $data['is_recurring_event'] = $is_recurring_event;
6811
+    $data['recurring_dates'] = $recurring_dates;
6812
+    $data['event_duration_days'] = $event_duration_days;
6813
+    $data['is_whole_day_event'] = $is_whole_day_event;
6814
+    $data['event_starttimes'] = $event_starttimes;
6815
+    $data['event_endtimes'] = $event_endtimes;
6816
+    $data['recurring_type'] = $recurring_type;
6817
+    $data['recurring_interval'] = $recurring_interval;
6818
+    $data['recurring_week_days'] = $recurring_week_days;
6819
+    $data['recurring_week_nos'] = $recurring_week_nos;
6820
+    $data['max_recurring_count'] = $max_recurring_count;
6821
+    $data['recurring_end_date'] = $recurring_end_date;
6822 6822
 	
6823
-	return $data;
6823
+    return $data;
6824 6824
 }
6825 6825
 
6826 6826
 /**
@@ -6836,12 +6836,12 @@  discard block
 block discarded – undo
6836 6836
  * @return doesn't Date.
6837 6837
  */
6838 6838
 function geodir_imex_get_date_ymd($date) {
6839
-	if (strpos($date, '/') !== false) {
6840
-		$date = str_replace('/', '-', $date); // PHP doesn't work well with dd/mm/yyyy format.
6841
-	}
6839
+    if (strpos($date, '/') !== false) {
6840
+        $date = str_replace('/', '-', $date); // PHP doesn't work well with dd/mm/yyyy format.
6841
+    }
6842 6842
 	
6843
-	$date = date_i18n('Y-m-d', strtotime($date));
6844
-	return $date;
6843
+    $date = date_i18n('Y-m-d', strtotime($date));
6844
+    return $date;
6845 6845
 }
6846 6846
 
6847 6847
 /**
@@ -6854,117 +6854,117 @@  discard block
 block discarded – undo
6854 6854
  * @return array Event data array.
6855 6855
  */
6856 6856
 function geodir_imex_process_event_data($gd_post) {
6857
-	$recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
6858
-
6859
-	$is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
6860
-	$event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : '';
6861
-	$event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date;
6862
-	$all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
6863
-	$starttime = isset($gd_post['starttime']) && !$all_day ? $gd_post['starttime'] : '';
6864
-	$endtime = isset($gd_post['endtime']) && !$all_day ? $gd_post['endtime'] : '';
6857
+    $recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
6858
+
6859
+    $is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
6860
+    $event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : '';
6861
+    $event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date;
6862
+    $all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
6863
+    $starttime = isset($gd_post['starttime']) && !$all_day ? $gd_post['starttime'] : '';
6864
+    $endtime = isset($gd_post['endtime']) && !$all_day ? $gd_post['endtime'] : '';
6865 6865
 	
6866
-	$repeat_type = '';
6867
-	$different_times = '';
6868
-	$starttimes = '';
6869
-	$endtimes = '';
6870
-	$repeat_days = '';
6871
-	$repeat_weeks = '';
6872
-	$event_recurring_dates = '';
6873
-	$repeat_x = '';
6874
-	$duration_x = '';
6875
-	$repeat_end_type = '';
6876
-	$max_repeat = '';
6877
-	$repeat_end = '';
6866
+    $repeat_type = '';
6867
+    $different_times = '';
6868
+    $starttimes = '';
6869
+    $endtimes = '';
6870
+    $repeat_days = '';
6871
+    $repeat_weeks = '';
6872
+    $event_recurring_dates = '';
6873
+    $repeat_x = '';
6874
+    $duration_x = '';
6875
+    $repeat_end_type = '';
6876
+    $max_repeat = '';
6877
+    $repeat_end = '';
6878 6878
 	
6879
-	if ($recurring_pkg && $is_recurring) {
6880
-		$repeat_type = $gd_post['recurring_type'];
6879
+    if ($recurring_pkg && $is_recurring) {
6880
+        $repeat_type = $gd_post['recurring_type'];
6881 6881
 		
6882
-		if ($repeat_type == 'custom') {
6883
-			$starttimes = !$all_day && !empty($gd_post['event_starttimes']) ? explode(",", $gd_post['event_starttimes']) : array();
6884
-			$endtimes = !$all_day && !empty($gd_post['event_endtimes']) ? explode(",", $gd_post['event_endtimes']) : array();
6882
+        if ($repeat_type == 'custom') {
6883
+            $starttimes = !$all_day && !empty($gd_post['event_starttimes']) ? explode(",", $gd_post['event_starttimes']) : array();
6884
+            $endtimes = !$all_day && !empty($gd_post['event_endtimes']) ? explode(",", $gd_post['event_endtimes']) : array();
6885 6885
 			
6886
-			if (!empty($starttimes) || !empty($endtimes)) {
6887
-				$different_times = true;
6888
-			}
6886
+            if (!empty($starttimes) || !empty($endtimes)) {
6887
+                $different_times = true;
6888
+            }
6889 6889
 			
6890
-			$recurring_dates = isset($gd_post['recurring_dates']) && $gd_post['recurring_dates'] != '' ? explode(",", $gd_post['recurring_dates']) : array();
6891
-			if (!empty($recurring_dates)) {
6892
-				$event_recurring_dates = array();
6890
+            $recurring_dates = isset($gd_post['recurring_dates']) && $gd_post['recurring_dates'] != '' ? explode(",", $gd_post['recurring_dates']) : array();
6891
+            if (!empty($recurring_dates)) {
6892
+                $event_recurring_dates = array();
6893 6893
 				
6894
-				foreach ($recurring_dates as $recurring_date) {
6895
-					$recurring_date = trim($recurring_date);
6894
+                foreach ($recurring_dates as $recurring_date) {
6895
+                    $recurring_date = trim($recurring_date);
6896 6896
 					
6897
-					if ($recurring_date != '') {
6898
-						$event_recurring_dates[] = geodir_imex_get_date_ymd($recurring_date);
6899
-					}
6900
-				}
6897
+                    if ($recurring_date != '') {
6898
+                        $event_recurring_dates[] = geodir_imex_get_date_ymd($recurring_date);
6899
+                    }
6900
+                }
6901 6901
 				
6902
-				$event_recurring_dates = array_unique($event_recurring_dates);
6903
-				$event_recurring_dates = implode(",", $event_recurring_dates);
6904
-			}
6905
-		} else {
6906
-			$duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6907
-			$repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6908
-			$max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6909
-			$repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6902
+                $event_recurring_dates = array_unique($event_recurring_dates);
6903
+                $event_recurring_dates = implode(",", $event_recurring_dates);
6904
+            }
6905
+        } else {
6906
+            $duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6907
+            $repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6908
+            $max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6909
+            $repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6910 6910
 			
6911
-			$repeat_end_type = $repeat_end != '' ? 1 : 0;
6912
-			$max_repeat = $repeat_end != '' ? '' : $max_repeat;
6911
+            $repeat_end_type = $repeat_end != '' ? 1 : 0;
6912
+            $max_repeat = $repeat_end != '' ? '' : $max_repeat;
6913 6913
 			
6914
-			$week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6914
+            $week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6915 6915
 			
6916
-			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6917
-			$repeat_days = array();
6918
-			if (!empty($a_repeat_days)) {
6919
-				foreach ($a_repeat_days as $repeat_day) {
6920
-					$repeat_day = geodir_strtolower(trim($repeat_day));
6916
+            $a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6917
+            $repeat_days = array();
6918
+            if (!empty($a_repeat_days)) {
6919
+                foreach ($a_repeat_days as $repeat_day) {
6920
+                    $repeat_day = geodir_strtolower(trim($repeat_day));
6921 6921
 					
6922
-					if ($repeat_day != '' && isset($week_days[$repeat_day])) {
6923
-						$repeat_days[] = $week_days[$repeat_day];
6924
-					}
6925
-				}
6922
+                    if ($repeat_day != '' && isset($week_days[$repeat_day])) {
6923
+                        $repeat_days[] = $week_days[$repeat_day];
6924
+                    }
6925
+                }
6926 6926
 				
6927
-				$repeat_days = array_unique($repeat_days);
6928
-			}
6927
+                $repeat_days = array_unique($repeat_days);
6928
+            }
6929 6929
 			
6930
-			$a_repeat_weeks = isset($gd_post['recurring_week_nos']) && trim($gd_post['recurring_week_nos']) != '' ? explode(",", trim($gd_post['recurring_week_nos'])) : array();
6931
-			$repeat_weeks = array();
6932
-			if (!empty($a_repeat_weeks)) {
6933
-				foreach ($a_repeat_weeks as $repeat_week) {
6934
-					$repeat_weeks[] = (int)$repeat_week;
6935
-				}
6930
+            $a_repeat_weeks = isset($gd_post['recurring_week_nos']) && trim($gd_post['recurring_week_nos']) != '' ? explode(",", trim($gd_post['recurring_week_nos'])) : array();
6931
+            $repeat_weeks = array();
6932
+            if (!empty($a_repeat_weeks)) {
6933
+                foreach ($a_repeat_weeks as $repeat_week) {
6934
+                    $repeat_weeks[] = (int)$repeat_week;
6935
+                }
6936 6936
 				
6937
-				$repeat_weeks = array_unique($repeat_weeks);
6938
-			}
6939
-		}
6940
-	}
6937
+                $repeat_weeks = array_unique($repeat_weeks);
6938
+            }
6939
+        }
6940
+    }
6941 6941
 	
6942
-	if (isset($gd_post['recurring_dates'])) {
6943
-		unset($gd_post['recurring_dates']);
6944
-	}
6942
+    if (isset($gd_post['recurring_dates'])) {
6943
+        unset($gd_post['recurring_dates']);
6944
+    }
6945 6945
 
6946
-	$gd_post['is_recurring'] = $is_recurring;
6947
-	$gd_post['event_date'] = $event_date;
6948
-	$gd_post['event_start'] = $event_date;
6949
-	$gd_post['event_end'] = $event_enddate;
6950
-	$gd_post['all_day'] = $all_day;
6951
-	$gd_post['starttime'] = $starttime;
6952
-	$gd_post['endtime'] = $endtime;
6946
+    $gd_post['is_recurring'] = $is_recurring;
6947
+    $gd_post['event_date'] = $event_date;
6948
+    $gd_post['event_start'] = $event_date;
6949
+    $gd_post['event_end'] = $event_enddate;
6950
+    $gd_post['all_day'] = $all_day;
6951
+    $gd_post['starttime'] = $starttime;
6952
+    $gd_post['endtime'] = $endtime;
6953 6953
 	
6954
-	$gd_post['repeat_type'] = $repeat_type;
6955
-	$gd_post['different_times'] = $different_times;
6956
-	$gd_post['starttimes'] = $starttimes;
6957
-	$gd_post['endtimes'] = $endtimes;
6958
-	$gd_post['repeat_days'] = $repeat_days;
6959
-	$gd_post['repeat_weeks'] = $repeat_weeks;
6960
-	$gd_post['event_recurring_dates'] = $event_recurring_dates;
6961
-	$gd_post['repeat_x'] = $repeat_x;
6962
-	$gd_post['duration_x'] = $duration_x;
6963
-	$gd_post['repeat_end_type'] = $repeat_end_type;
6964
-	$gd_post['max_repeat'] = $max_repeat;
6965
-	$gd_post['repeat_end'] = $repeat_end;
6966
-
6967
-	return $gd_post;
6954
+    $gd_post['repeat_type'] = $repeat_type;
6955
+    $gd_post['different_times'] = $different_times;
6956
+    $gd_post['starttimes'] = $starttimes;
6957
+    $gd_post['endtimes'] = $endtimes;
6958
+    $gd_post['repeat_days'] = $repeat_days;
6959
+    $gd_post['repeat_weeks'] = $repeat_weeks;
6960
+    $gd_post['event_recurring_dates'] = $event_recurring_dates;
6961
+    $gd_post['repeat_x'] = $repeat_x;
6962
+    $gd_post['duration_x'] = $duration_x;
6963
+    $gd_post['repeat_end_type'] = $repeat_end_type;
6964
+    $gd_post['max_repeat'] = $max_repeat;
6965
+    $gd_post['repeat_end'] = $repeat_end;
6966
+
6967
+    return $gd_post;
6968 6968
 }
6969 6969
 
6970 6970
 /**
@@ -7036,12 +7036,12 @@  discard block
 block discarded – undo
7036 7036
  * @return Original element id.
7037 7037
  */
7038 7038
 function geodir_imex_original_post_id($element_id, $element_type) {
7039
-	global $sitepress;
7039
+    global $sitepress;
7040 7040
 	
7041
-	$original_element_id = $sitepress->get_original_element_id($element_id, $element_type);
7042
-	$element_id = $element_id != $original_element_id ? $original_element_id : '';
7041
+    $original_element_id = $sitepress->get_original_element_id($element_id, $element_type);
7042
+    $element_id = $element_id != $original_element_id ? $original_element_id : '';
7043 7043
 	
7044
-	return $element_id;
7044
+    return $element_id;
7045 7045
 }
7046 7046
 
7047 7047
 /*
@@ -7121,15 +7121,15 @@  discard block
 block discarded – undo
7121 7121
  * @global object $sitepress Sitepress WPML object.
7122 7122
  */
7123 7123
 function geodir_wpml_permalink_setting_notice() {
7124
-	if (geodir_is_wpml()) {
7125
-		global $sitepress;
7126
-		$current_language = $sitepress->get_current_language();
7127
-		$default_language = $sitepress->get_default_language();
7128
-		if ($current_language != 'all' && $current_language != $default_language) {
7129
-	?>
7124
+    if (geodir_is_wpml()) {
7125
+        global $sitepress;
7126
+        $current_language = $sitepress->get_current_language();
7127
+        $default_language = $sitepress->get_default_language();
7128
+        if ($current_language != 'all' && $current_language != $default_language) {
7129
+    ?>
7130 7130
 	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory');?></strong></p></div>
7131 7131
 	<?php
7132
-		}
7133
-	}
7132
+        }
7133
+    }
7134 7134
 }
7135 7135
 ?>
7136 7136
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +642 added lines, -642 removed lines patch added patch discarded remove patch
@@ -480,15 +480,15 @@  discard block
 block discarded – undo
480 480
                 <?php
481 481
 
482 482
                     $default_location = geodir_get_default_location();
483
-                  $city =  isset($default_location->city) ? $default_location->city : '';
484
-                  $region =isset($default_location->region) ? $default_location->region : '';
485
-                  $country =isset($default_location->country) ? $default_location->country : '';
486
-                  $city_latitude =isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
-                  $city_longitude =isset($default_location->city_longitude) ? $default_location->city_longitude : '';
483
+                  $city = isset($default_location->city) ? $default_location->city : '';
484
+                  $region = isset($default_location->region) ? $default_location->region : '';
485
+                  $country = isset($default_location->country) ? $default_location->country : '';
486
+                  $city_latitude = isset($default_location->city_latitude) ? $default_location->city_latitude : '';
487
+                  $city_longitude = isset($default_location->city_longitude) ? $default_location->city_longitude : '';
488 488
 
489 489
                 ?>
490 490
                 var geocoder = new google.maps.Geocoder();
491
-                var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>';
491
+                var CITY_ADDRESS = '<?php echo $city . ',' . $region . ',' . $country; ?>';
492 492
                 var bound_lat_lng;
493 493
                 var lat = <?php echo $city_latitude; ?>;
494 494
                 var lng = <?php echo $city_longitude; ?>;
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
                             );
526 526
 
527 527
                         } else {
528
-                            alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
528
+                            alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
529 529
                         }
530 530
                     });
531 531
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
                     var total_dummy_post_count = jQuery('#sub_' + active_tab).find('.selected_sample_data').val();
539 539
 
540 540
                     if (id == 'geodir_dummy_delete') {
541
-                        if (confirm('<?php _e('Are you sure you want to delete dummy data?' , 'geodirectory'); ?>')) {
541
+                        if (confirm('<?php _e('Are you sure you want to delete dummy data?', 'geodirectory'); ?>')) {
542 542
                             jQuery('#sub_' + active_tab).find('.geodir_auto_install').hide();
543 543
                             jQuery('#sub_' + active_tab).find('.geodir_show_progress').show();
544 544
                             jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&_wpnonce=' + nonce,
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
                         jQuery.post('<?php echo geodir_get_ajax_url(); ?>&geodir_autofill=' + id + '&posttype=' + posttype + '&insert_dummy_post_index=' + dummy_post_index + '&city_bound_lat1=' + bound_lat_lng[0] + '&city_bound_lng1=' + bound_lat_lng[1] + '&city_bound_lat2=' + bound_lat_lng[2] + '&city_bound_lng2=' + bound_lat_lng[3] + '&_wpnonce=' + nonce,
558 558
                             function (data) {
559 559
 
560
-                                jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:','geodirectory');?> ' + dummy_post_index + ' <?php _e('of' ,'geodirectory'); ?> ' + total_dummy_post_count + '');
560
+                                jQuery(obj).closest('form').find('.dummy_post_inserted').html('<?php _e('Dummy post(s) inserted:', 'geodirectory'); ?> ' + dummy_post_index + ' <?php _e('of', 'geodirectory'); ?> ' + total_dummy_post_count + '');
561 561
                                 dummy_post_index++;
562 562
                                 if (dummy_post_index <= total_dummy_post_count)
563 563
                                     geodir_autoinstall(obj, id, nonce, posttype);
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
                     else
669 669
                         $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
670 670
                     $catname = str_replace(' ', '_', $catname);
671
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
671
+                    $uploaded = (array) fetch_remote_file("$dummy_image_url/" . $catname . ".png");
672 672
 
673 673
                     if (empty($uploaded['error'])) {
674 674
                         $new_path = $uploaded['file'];
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
                 else
710 710
                     $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
711 711
                 $catname = str_replace(' ', '_', $catname);
712
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
712
+                $uploaded = (array) fetch_remote_file("$dummy_image_url/" . $catname . ".png");
713 713
 
714 714
                 if (empty($uploaded['error'])) {
715 715
                     $new_path = $uploaded['file'];
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
  */
1022 1022
 function geodir_extend_geodirectory_setting_tab($tabs)
1023 1023
 {
1024
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1024
+    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory') . ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1025 1025
     return $tabs;
1026 1026
 }
1027 1027
 
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 function geodir_post_information_save($post_id, $post) {
1175 1175
     global $wpdb, $current_user;
1176 1176
 
1177
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1177
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
1178 1178
         return;
1179 1179
     }
1180 1180
 
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
 
1257 1257
         if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] == 'csv_upload_settings') {
1258 1258
             if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'success') {
1259
-                $rowcount = (int)$_REQUEST['rowcount'];
1259
+                $rowcount = (int) $_REQUEST['rowcount'];
1260 1260
                 $uploads = wp_upload_dir();
1261 1261
                 ?>
1262 1262
                 <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204); margin-left:0px; margin-top:0px; margin-bottom:10px;">
@@ -1270,25 +1270,25 @@  discard block
 block discarded – undo
1270 1270
 
1271 1271
                     if (isset($_REQUEST['invalidcount']) && $_REQUEST['invalidcount'] > 0) {
1272 1272
                         echo '<p>';
1273
-                        printf(CSV_INVALID_DEFUALT_ADDRESS, (int)$_REQUEST['invalidcount'], (int)$_REQUEST['total_records']);
1273
+                        printf(CSV_INVALID_DEFUALT_ADDRESS, (int) $_REQUEST['invalidcount'], (int) $_REQUEST['total_records']);
1274 1274
                         echo '</p>';
1275 1275
                     }
1276 1276
 
1277 1277
                     if (isset($_REQUEST['blank_address']) && $_REQUEST['blank_address'] > 0) {
1278 1278
                         echo '<p>';
1279
-                        printf(CSV_INVALID_TOTAL_RECORD, (int)$_REQUEST['blank_address'], (int)$_REQUEST['total_records']);
1279
+                        printf(CSV_INVALID_TOTAL_RECORD, (int) $_REQUEST['blank_address'], (int) $_REQUEST['total_records']);
1280 1280
                         echo '</p>';
1281 1281
                     }
1282 1282
 
1283 1283
                     if (isset($_REQUEST['invalid_post_type']) && $_REQUEST['invalid_post_type'] > 0) {
1284 1284
                         echo '<p>';
1285
-                        printf(CSV_INVALID_POST_TYPE, (int)$_REQUEST['invalid_post_type'], (int)$_REQUEST['total_records']);
1285
+                        printf(CSV_INVALID_POST_TYPE, (int) $_REQUEST['invalid_post_type'], (int) $_REQUEST['total_records']);
1286 1286
                         echo '</p>';
1287 1287
                     }
1288 1288
 
1289 1289
                     if (isset($_REQUEST['invalid_title']) && $_REQUEST['invalid_title'] > 0) {
1290 1290
                         echo '<p>';
1291
-                        printf(CSV_BLANK_POST_TITLE, (int)$_REQUEST['invalid_title'], (int)$_REQUEST['total_records']);
1291
+                        printf(CSV_BLANK_POST_TITLE, (int) $_REQUEST['invalid_title'], (int) $_REQUEST['total_records']);
1292 1292
                         echo '</p>';
1293 1293
                     }
1294 1294
 
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
                     jQuery('#gd-import-perc').text('0%');
1491 1491
 
1492 1492
                     jQuery('.gd-csv-form-table .filelist .file').remove();
1493
-                    jQuery('#gd-import-msg').find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
1493
+                    jQuery('#gd-import-msg').find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
1494 1494
                     jQuery('#gd-import-msg').show();
1495 1495
 
1496 1496
                     return false;
@@ -1658,38 +1658,38 @@  discard block
 block discarded – undo
1658 1658
 
1659 1659
                 var gdMsg = '<p></p>';
1660 1660
                 if (gd_invalidcount == 0 && gd_blank_address == 0 && gd_invalid_post_type == 0 && gd_invalid_title == 0) {
1661
-                    gdMsg += "<p><?php echo esc_attr( CSV_INSERT_DATA );?></p>";
1661
+                    gdMsg += "<p><?php echo esc_attr(CSV_INSERT_DATA); ?></p>";
1662 1662
                 }
1663 1663
 
1664
-                var msgParse = '<p><?php echo addslashes( CSV_TOTAL_RECORD );?></p>';
1664
+                var msgParse = '<p><?php echo addslashes(CSV_TOTAL_RECORD); ?></p>';
1665 1665
                 gdMsg += msgParse.replace("%s", gd_rowcount);
1666 1666
 
1667 1667
                 if (gd_invalidcount > 0) {
1668
-                    msgParse = msgParse = '<p><?php echo sprintf( CSV_INVALID_DEFUALT_ADDRESS, '%s', '%d' );?></p>';
1668
+                    msgParse = msgParse = '<p><?php echo sprintf(CSV_INVALID_DEFUALT_ADDRESS, '%s', '%d'); ?></p>';
1669 1669
                     msgParse = msgParse.replace("%s", gd_invalidcount);
1670 1670
                     msgParse = msgParse.replace("%d", gd_total_records);
1671 1671
                     gdMsg += msgParse;
1672 1672
                 }
1673 1673
                 if (gd_blank_address > 0) {
1674
-                    msgParse = '<p><?php echo addslashes( sprintf( CSV_INVALID_TOTAL_RECORD, '%s', '%d' ) );?></p>';
1674
+                    msgParse = '<p><?php echo addslashes(sprintf(CSV_INVALID_TOTAL_RECORD, '%s', '%d')); ?></p>';
1675 1675
                     msgParse = msgParse.replace("%s", gd_blank_address);
1676 1676
                     msgParse = msgParse.replace("%d", gd_total_records);
1677 1677
                     gdMsg += msgParse;
1678 1678
                 }
1679 1679
                 if (gd_invalid_post_type > 0) {
1680
-                    msgParse = '<p><?php echo addslashes( sprintf( CSV_INVALID_POST_TYPE, '%s', '%d' ) );?></p>';
1680
+                    msgParse = '<p><?php echo addslashes(sprintf(CSV_INVALID_POST_TYPE, '%s', '%d')); ?></p>';
1681 1681
                     msgParse = msgParse.replace("%s", gd_invalid_post_type);
1682 1682
                     msgParse = msgParse.replace("%d", gd_total_records);
1683 1683
                     gdMsg += msgParse;
1684 1684
                 }
1685 1685
                 if (gd_invalid_title > 0) {
1686
-                    msgParse = '<p><?php echo addslashes( sprintf( CSV_BLANK_POST_TITLE, '%s', '%d' ) );?></p>';
1686
+                    msgParse = '<p><?php echo addslashes(sprintf(CSV_BLANK_POST_TITLE, '%s', '%d')); ?></p>';
1687 1687
                     msgParse = msgParse.replace("%s", gd_invalid_title);
1688 1688
                     msgParse = msgParse.replace("%d", gd_total_records);
1689 1689
                     gdMsg += msgParse;
1690 1690
                 }
1691 1691
                 if (gd_upload_files > 0) {
1692
-                    gdMsg += '<p><?php echo addslashes( sprintf( CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'] ) );?></p>';
1692
+                    gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?></p>';
1693 1693
                 }
1694 1694
                 gdMsg += '<p></p>';
1695 1695
                 jQuery('#gd-import-msg').find('#message').removeClass('error').addClass('updated').html(gdMsg);
@@ -1699,7 +1699,7 @@  discard block
 block discarded – undo
1699 1699
         <table class="form-table gd-csv-form-table">
1700 1700
             <tbody>
1701 1701
             <tr valign="top" class="single_select_page">
1702
-                <th class="titledesc" scope="row"><?php echo SELECT_CSV_FILE;?></th>
1702
+                <th class="titledesc" scope="row"><?php echo SELECT_CSV_FILE; ?></th>
1703 1703
                 <td class="forminp">
1704 1704
                     <div class="gtd-formfeild">
1705 1705
                         <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox">
@@ -1734,12 +1734,12 @@  discard block
 block discarded – undo
1734 1734
                                id="gd_import_data" class="button-primary" name="save">
1735 1735
                         <input onclick="gdContinueImport()" type="button" value="Continue Import Data"
1736 1736
                                id="gd_continue_data" class="button-primary" style="display:none"/>
1737
-                        <input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>"
1737
+                        <input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>"
1738 1738
                                id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none"
1739 1739
                                onclick="gdTerminateImport()"/>
1740 1740
 
1741 1741
                         <div id="gd_process_data" style="display:none"><span class="spinner"
1742
-                                                                             style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
1742
+                                                                             style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
1743 1743
                         </div>
1744 1744
                     </div>
1745 1745
                     <div id="gd_importer" style="display:none">
@@ -1757,7 +1757,7 @@  discard block
 block discarded – undo
1757 1757
                         <input type="hidden" id="gd_total_records" value="0"/>
1758 1758
                     </div>
1759 1759
                     <div class="gd-import-progress" id="gd-import-progress" style="display:none">
1760
-                        <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
1760
+                        <div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
1761 1761
                                 id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
1762 1762
                                 id="gd-import-perc">0%</font> )
1763 1763
                             <div class="gd-fileprogress"></div>
@@ -2016,7 +2016,7 @@  discard block
 block discarded – undo
2016 2016
                             $payment_info = array();
2017 2017
                             $package_info = array();
2018 2018
 
2019
-                            $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
2019
+                            $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]);
2020 2020
                             $package_id = '';
2021 2021
                             if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
2022 2022
                                 $package_id = $gd_post_info['package_id'];
@@ -2250,7 +2250,7 @@  discard block
 block discarded – undo
2250 2250
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
2251 2251
                                            id="<?php echo esc_attr($value['id']); ?>"
2252 2252
                                            type="<?php echo esc_attr($value['type']); ?>"
2253
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2253
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2254 2254
                                            style=" <?php echo esc_attr($value['css']); ?>"
2255 2255
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
2256 2256
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -2267,7 +2267,7 @@  discard block
 block discarded – undo
2267 2267
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
2268 2268
                                            id="<?php echo esc_attr($value['id']); ?>"
2269 2269
                                            type="<?php echo esc_attr($value['type']); ?>"
2270
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2270
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2271 2271
                                            style="<?php echo esc_attr($value['css']); ?>"
2272 2272
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
2273 2273
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -2368,7 +2368,7 @@  discard block
 block discarded – undo
2368 2368
                                             id="<?php echo esc_attr($value['id']); ?>"
2369 2369
                                             style="<?php echo esc_attr($value['css']); ?>"
2370 2370
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
2371
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
2371
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>"
2372 2372
                                             option-ajaxchosen="false">
2373 2373
                         <?php
2374 2374
                         foreach ($value['options'] as $key => $val) {
@@ -2416,7 +2416,7 @@  discard block
 block discarded – undo
2416 2416
                 ?>
2417 2417
 
2418 2418
                 <tr valign="top">
2419
-                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
2419
+                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th>
2420 2420
                     <td width="60%">
2421 2421
                         <select name="geodir_default_map_language" style="width:60%">
2422 2422
                             <?php
@@ -2498,7 +2498,7 @@  discard block
 block discarded – undo
2498 2498
 
2499 2499
                 <tr valign="top">
2500 2500
                     <th class="titledesc"
2501
-                        width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th>
2501
+                        width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th>
2502 2502
                     <td width="60%">
2503 2503
                         <select name="geodir_default_map_search_pt" style="width:60%">
2504 2504
                             <?php
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
                         $cat_display = 'checkbox';
2540 2540
                         $gd_post_types = get_option('geodir_exclude_post_type_on_map');
2541 2541
                         $gd_cats = get_option('geodir_exclude_cat_on_map');
2542
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
2542
+                        $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
2543 2543
                         $count = 1;
2544 2544
                         ?>
2545 2545
                         <table width="70%" class="widefat">
@@ -2568,7 +2568,7 @@  discard block
 block discarded – undo
2568 2568
                                                                                            name="home_map_post_types[]"
2569 2569
                                                                                            id="<?php echo esc_attr($value['id']); ?>"
2570 2570
                                                                                            value="<?php echo $key; ?>"
2571
-                                                                                           class="map_post_type" <?php echo $checked;?> />
2571
+                                                                                           class="map_post_type" <?php echo $checked; ?> />
2572 2572
                                         <?php echo $post_types_obj->labels->singular_name; ?></td>
2573 2573
                                     <td width="40%">
2574 2574
                                         <div class="home_map_category" style="overflow:auto;width:200px;height:100px;"
@@ -2626,12 +2626,12 @@  discard block
 block discarded – undo
2626 2626
                 ?>
2627 2627
                 <fieldset>
2628 2628
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
2629
-                    <label for="<?php echo $value['id'];?>">
2629
+                    <label for="<?php echo $value['id']; ?>">
2630 2630
                         <input name="<?php echo esc_attr($value['id']); ?>"
2631 2631
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
2632 2632
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
2633 2633
                             echo 'checked="checked"';
2634
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
2634
+                        }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> />
2635 2635
                         <?php echo $value['desc']; ?></label><br>
2636 2636
                 </fieldset>
2637 2637
                 <?php
@@ -2653,7 +2653,7 @@  discard block
 block discarded – undo
2653 2653
                     <textarea
2654 2654
                         <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
2655 2655
                         id="<?php echo esc_attr($value['id']); ?>"
2656
-                        <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2656
+                        <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
2657 2657
                         style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea($value['std']); ?></textarea><span
2658 2658
                         class="description"><?php echo $value['desc'] ?></span>
2659 2659
 
@@ -2700,7 +2700,7 @@  discard block
 block discarded – undo
2700 2700
 					}
2701 2701
 				}
2702 2702
 				//
2703
-				$page_setting = (int)get_option($value['id']);
2703
+				$page_setting = (int) get_option($value['id']);
2704 2704
 
2705 2705
                 $args = array('name' => $value['id'],
2706 2706
                     'id' => $value['id'],
@@ -2727,7 +2727,7 @@  discard block
 block discarded – undo
2727 2727
                 break;
2728 2728
             case 'single_select_country' :
2729 2729
                 $countries = $geodirectory->countries->countries;
2730
-                $country_setting = (string)get_option($value['id']);
2730
+                $country_setting = (string) get_option($value['id']);
2731 2731
                 if (strstr($country_setting, ':')) :
2732 2732
                     $country = current(explode(':', $country_setting));
2733 2733
                     $state = end(explode(':', $country_setting));
@@ -2750,7 +2750,7 @@  discard block
 block discarded – undo
2750 2750
             case 'multi_select_countries' :
2751 2751
                 $countries = $geodirectory->countries->countries;
2752 2752
                 asort($countries);
2753
-                $selections = (array)get_option($value['id']);
2753
+                $selections = (array) get_option($value['id']);
2754 2754
                 ?>
2755 2755
                 <tr valign="top">
2756 2756
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -2772,8 +2772,8 @@  discard block
 block discarded – undo
2772 2772
                 break;
2773 2773
 
2774 2774
             case 'google_analytics' :
2775
-                $selections = (array)get_option($value['id']);
2776
-                if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
2775
+                $selections = (array) get_option($value['id']);
2776
+                if (get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret')) {
2777 2777
                     ?>
2778 2778
                     <tr valign="top">
2779 2779
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -2784,10 +2784,10 @@  discard block
 block discarded – undo
2784 2784
 
2785 2785
                             $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
2786 2786
                             $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
2787
-                            $state = "&state=123";//any string
2787
+                            $state = "&state=123"; //any string
2788 2788
                             $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2789 2789
                             $response_type = "&response_type=code";
2790
-                            $client_id = "&client_id=".get_option('geodir_ga_client_id');
2790
+                            $client_id = "&client_id=" . get_option('geodir_ga_client_id');
2791 2791
                             $access_type = "&access_type=offline";
2792 2792
                             $approval_prompt = "&approval_prompt=force";
2793 2793
 
@@ -2797,7 +2797,7 @@  discard block
 block discarded – undo
2797 2797
                             ?>
2798 2798
                             <script>
2799 2799
                                 function gd_ga_popup() {
2800
-                                    var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
2800
+                                    var win = window.open("<?php echo $auth_url; ?>", "Google Analytics", "");
2801 2801
                                     var pollTimer = window.setInterval(function () {
2802 2802
                                         if (win.closed !== false) { // !== is required for compatibility with Opera
2803 2803
                                             window.clearInterval(pollTimer);
@@ -2819,7 +2819,7 @@  discard block
 block discarded – undo
2819 2819
                             } else {
2820 2820
                                 ?>
2821 2821
                                 <span class="button-primary"
2822
-                                      onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
2822
+                                      onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory'); ?></span>
2823 2823
                             <?php
2824 2824
                             }
2825 2825
                             ?>
@@ -2890,9 +2890,9 @@  discard block
 block discarded – undo
2890 2890
 
2891 2891
             <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?>
2892 2892
             jQuery('.geodir_option_tabs').removeClass('gd-tab-active');
2893
-            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active');
2893
+            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active');
2894 2894
             jQuery('.gd-content-heading').hide();
2895
-            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show();
2895
+            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show();
2896 2896
             <?php } ?>
2897 2897
         });
2898 2898
     </script>
@@ -3034,7 +3034,7 @@  discard block
 block discarded – undo
3034 3034
         <div
3035 3035
             class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
3036 3036
             id="<?php echo $id; ?>plupload-upload-ui">
3037
-            <h4><?php _e('Drop files to upload', 'geodirectory');?></h4>
3037
+            <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4>
3038 3038
             <input id="<?php echo $id; ?>plupload-browse-button" type="button"
3039 3039
                    value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/>
3040 3040
             <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
@@ -3049,7 +3049,7 @@  discard block
 block discarded – undo
3049 3049
              id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
3050 3050
         </div>
3051 3051
         <span
3052
-            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
3052
+            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
3053 3053
         <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
3054 3054
     </div>
3055 3055
 
@@ -3427,11 +3427,11 @@  discard block
 block discarded – undo
3427 3427
 function geodir_hide_admin_preview_button() {
3428 3428
     global $post_type;
3429 3429
     $post_types = geodir_get_posttypes();
3430
-    if(in_array($post_type, $post_types))
3430
+    if (in_array($post_type, $post_types))
3431 3431
         echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
3432 3432
 }
3433
-add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
3434
-add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
3433
+add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button');
3434
+add_action('admin_head-post.php', 'geodir_hide_admin_preview_button');
3435 3435
 
3436 3436
 /**
3437 3437
  * Add the tab in left sidebar menu fro import & export page.
@@ -3441,8 +3441,8 @@  discard block
 block discarded – undo
3441 3441
  *
3442 3442
  * @return array Array of tab data.
3443 3443
  */
3444
-function geodir_import_export_tab( $tabs ) {
3445
-	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
3444
+function geodir_import_export_tab($tabs) {
3445
+	$tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory'));
3446 3446
     return $tabs;
3447 3447
 }
3448 3448
 
@@ -3456,7 +3456,7 @@  discard block
 block discarded – undo
3456 3456
  * @return string Html content.
3457 3457
  */
3458 3458
 function geodir_import_export_page() {
3459
-	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
3459
+	$nonce = wp_create_nonce('geodir_import_export_nonce');
3460 3460
 	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
3461 3461
     /**
3462 3462
      * Filter sample category data csv file url.
@@ -3466,7 +3466,7 @@  discard block
 block discarded – undo
3466 3466
      *
3467 3467
      * @param string $gd_cats_sample_csv Sample category data csv file url.
3468 3468
      */
3469
-	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
3469
+	$gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
3470 3470
 	
3471 3471
 	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
3472 3472
     /**
@@ -3477,15 +3477,15 @@  discard block
 block discarded – undo
3477 3477
      *
3478 3478
      * @param string $gd_posts_sample_csv Sample post data csv file url.
3479 3479
      */
3480
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
3480
+    $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
3481 3481
 	
3482
-	$gd_posttypes = geodir_get_posttypes( 'array' );
3482
+	$gd_posttypes = geodir_get_posttypes('array');
3483 3483
 	
3484 3484
 	$gd_posttypes_option = '';
3485
-	foreach ( $gd_posttypes as $gd_posttype => $row ) {
3486
-		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>';
3485
+	foreach ($gd_posttypes as $gd_posttype => $row) {
3486
+		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int) geodir_get_terms_count($gd_posttype) . '" data-posts="' . (int) geodir_get_posts_count($gd_posttype) . '">' . __($row['labels']['name'], 'geodirectory') . '</option>';
3487 3487
 	}
3488
-	wp_enqueue_script( 'jquery-ui-progressbar' );
3488
+	wp_enqueue_script('jquery-ui-progressbar');
3489 3489
 	
3490 3490
 	$gd_chunksize_options = array();
3491 3491
 	$gd_chunksize_options[100] = 100;
@@ -3507,7 +3507,7 @@  discard block
 block discarded – undo
3507 3507
      *
3508 3508
      * @param string $gd_chunksize_options Entries options.
3509 3509
      */
3510
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
3510
+    $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options);
3511 3511
 	
3512 3512
 	$gd_chunksize_option = '';
3513 3513
 	foreach ($gd_chunksize_options as $value => $title) {
@@ -3518,38 +3518,38 @@  discard block
 block discarded – undo
3518 3518
 ?>
3519 3519
 </form>
3520 3520
 <div class="inner_content_tab_main gd-import-export">
3521
-  <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3>
3522
-  <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span>
3521
+  <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3>
3522
+  <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span>
3523 3523
   <div class="gd-content-heading">
3524 3524
 
3525 3525
   <?php
3526 3526
     ini_set('max_execution_time', 999999);
3527
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
3527
+    $ini_max_execution_time_check = @ini_get('max_execution_time');
3528 3528
     ini_restore('max_execution_time');
3529 3529
 
3530
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
3530
+    if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting
3531 3531
         ?>
3532 3532
 	<div id="gd_ie_reqs" class="metabox-holder">
3533 3533
       <div class="meta-box-sortables ui-sortable">
3534 3534
         <div class="postbox">
3535
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3>
3535
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3>
3536 3536
           <div class="inside">
3537
-            <span class="description"><?php echo __( 'Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory' );?></span>
3537
+            <span class="description"><?php echo __('Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory'); ?></span>
3538 3538
 			<table class="form-table">
3539 3539
 				<thead>
3540 3540
 				  <tr>
3541
-				  	<th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th>
3541
+				  	<th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th>
3542 3542
 				  </tr>
3543 3543
 				</thead>
3544 3544
 				<tbody>
3545 3545
 				  <tr>
3546
-				  	<td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td>
3546
+				  	<td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td>
3547 3547
 				  </tr>
3548 3548
 				  <tr>
3549
-				  	<td>max_execution_time</td><td><?php  echo @ini_get( 'max_execution_time' );?></td><td>3000</td>
3549
+				  	<td>max_execution_time</td><td><?php  echo @ini_get('max_execution_time'); ?></td><td>3000</td>
3550 3550
 				  </tr>
3551 3551
 				  <tr>
3552
-				  	<td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td>
3552
+				  	<td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td>
3553 3553
 				  </tr>
3554 3554
 				</tbody>
3555 3555
 		    </table>
@@ -3561,20 +3561,20 @@  discard block
 block discarded – undo
3561 3561
 	<div id="gd_ie_imposts" class="metabox-holder">
3562 3562
       <div class="meta-box-sortables ui-sortable">
3563 3563
         <div id="gd_ie_im_posts" class="postbox">
3564
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3>
3564
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3>
3565 3565
           <div class="inside">
3566 3566
             <table class="form-table">
3567 3567
 				<tbody>
3568 3568
 				  <tr>
3569 3569
 					<td class="gd-imex-box">
3570 3570
 						<div class="gd-im-choices">
3571
-						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e( 'Update listing if post with post_id already exists.', 'geodirectory' );?></label></p>
3572
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e( 'Ignore listing if post with post_id already exists.', 'geodirectory' );?></label></p>
3571
+						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e('Update listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
3572
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e('Ignore listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
3573 3573
 						</div>
3574 3574
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui">
3575 3575
 							<input type="text" readonly="readonly" name="gd_im_post_file" class="gd-imex-file gd_im_post_file" id="gd_im_post" onclick="jQuery('#gd_im_postplupload-browse-button').trigger('click');" />
3576
-							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
3577
-						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" />
3576
+							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
3577
+						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" />
3578 3578
 							<?php
3579 3579
 							/**
3580 3580
 							 * Called just after the sample CSV download link.
@@ -3583,7 +3583,7 @@  discard block
 block discarded – undo
3583 3583
 							 */
3584 3584
 							do_action('geodir_sample_csv_download_link');
3585 3585
 							?>
3586
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span>
3586
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span>
3587 3587
 							<div class="filelist"></div>
3588 3588
 						</div>
3589 3589
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -3601,7 +3601,7 @@  discard block
 block discarded – undo
3601 3601
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
3602 3602
 						</div>
3603 3603
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
3604
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
3604
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
3605 3605
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
3606 3606
 									id="gd-import-perc">0%</font> )
3607 3607
 								<div class="gd-fileprogress"></div>
@@ -3613,10 +3613,10 @@  discard block
 block discarded – undo
3613 3613
                     	<div class="gd-imex-btns" style="display:none;">
3614 3614
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
3615 3615
                         	<input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
3616
-                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
3617
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
3616
+                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
3617
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
3618 3618
 							<div id="gd_process_data" style="display:none">
3619
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
3619
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
3620 3620
 							</div>
3621 3621
 						</div>
3622 3622
 					</td>
@@ -3630,25 +3630,25 @@  discard block
 block discarded – undo
3630 3630
 	<div id="gd_ie_excategs" class="metabox-holder">
3631 3631
 	  <div class="meta-box-sortables ui-sortable">
3632 3632
 		<div id="gd_ie_ex_posts" class="postbox">
3633
-		  <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3>
3633
+		  <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
3634 3634
 		  <div class="inside">
3635 3635
 			<table class="form-table">
3636 3636
 			  <tbody>
3637 3637
 				<tr>
3638 3638
 				  <td class="fld"><label for="gd_post_type">
3639
-					<?php _e( 'Post Type:', 'geodirectory' );?>
3639
+					<?php _e('Post Type:', 'geodirectory'); ?>
3640 3640
 					</label></td>
3641 3641
 				  <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px">
3642
-					  <?php echo $gd_posttypes_option;?>
3642
+					  <?php echo $gd_posttypes_option; ?>
3643 3643
 					</select></td>
3644 3644
 				</tr>
3645 3645
 				<tr>
3646
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
3647
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
3646
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
3647
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
3648 3648
 				  </tr>
3649 3649
 				<tr>
3650 3650
 				  <td class="fld" style="vertical-align:top"><label>
3651
-					<?php _e( 'Progress:', 'geodirectory' );?>
3651
+					<?php _e('Progress:', 'geodirectory'); ?>
3652 3652
 					</label></td>
3653 3653
 				  <td><div id='gd_progressbar_box'>
3654 3654
 					  <div id="gd_progressbar" class="gd_progressbar">
@@ -3656,13 +3656,13 @@  discard block
 block discarded – undo
3656 3656
 					  </div>
3657 3657
 					</div>
3658 3658
 					<p style="display:inline-block">
3659
-					  <?php _e( 'Elapsed Time:', 'geodirectory' );?>
3659
+					  <?php _e('Elapsed Time:', 'geodirectory'); ?>
3660 3660
 					</p>
3661 3661
 					  
3662 3662
 					<p id="gd_timer" class="gd_timer">00:00:00</p></td>
3663 3663
 				</tr>
3664 3664
 				<tr class="gd-ie-actions">
3665
-				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
3665
+				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
3666 3666
 				  </td>
3667 3667
 				  <td id="gd_ie_ex_files" class="gd-ie-files"></td>
3668 3668
 				</tr>
@@ -3675,20 +3675,20 @@  discard block
 block discarded – undo
3675 3675
 	<div id="gd_ie_imcategs" class="metabox-holder">
3676 3676
       <div class="meta-box-sortables ui-sortable">
3677 3677
         <div id="gd_ie_imcats" class="postbox">
3678
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3>
3678
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
3679 3679
           <div class="inside">
3680 3680
             <table class="form-table">
3681 3681
 				<tbody>
3682 3682
 				  <tr>
3683 3683
 					<td class="gd-imex-box">
3684 3684
 						<div class="gd-im-choices">
3685
-						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e( 'Update item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
3686
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e( 'Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
3685
+						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e('Update item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
3686
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e('Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
3687 3687
 						</div>
3688 3688
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui">
3689 3689
 							<input type="text" readonly="readonly" name="gd_im_cat_file" class="gd-imex-file gd_im_cat_file" id="gd_im_cat" onclick="jQuery('#gd_im_catplupload-browse-button').trigger('click');" />
3690
-							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
3691
-						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" />
3690
+							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
3691
+						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" />
3692 3692
 						<?php
3693 3693
 						/**
3694 3694
 						 * Called just after the sample CSV download link.
@@ -3698,7 +3698,7 @@  discard block
 block discarded – undo
3698 3698
 						 */
3699 3699
 						do_action('geodir_sample_cats_csv_download_link');
3700 3700
 						?>
3701
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span>
3701
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
3702 3702
 							<div class="filelist"></div>
3703 3703
 						</div>
3704 3704
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -3715,7 +3715,7 @@  discard block
 block discarded – undo
3715 3715
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
3716 3716
 						</div>
3717 3717
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
3718
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
3718
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
3719 3719
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
3720 3720
 									id="gd-import-perc">0%</font> )
3721 3721
 								<div class="gd-fileprogress"></div>
@@ -3727,10 +3727,10 @@  discard block
 block discarded – undo
3727 3727
                     	<div class="gd-imex-btns" style="display:none;">
3728 3728
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
3729 3729
                         	<input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
3730
-                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
3731
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
3730
+                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
3731
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
3732 3732
 							<div id="gd_process_data" style="display:none">
3733
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
3733
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
3734 3734
 							</div>
3735 3735
 						</div>
3736 3736
 					</td>
@@ -3744,25 +3744,25 @@  discard block
 block discarded – undo
3744 3744
 	<div id="gd_ie_excategs" class="metabox-holder">
3745 3745
       <div class="meta-box-sortables ui-sortable">
3746 3746
         <div id="gd_ie_ex_cats" class="postbox">
3747
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3>
3747
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
3748 3748
           <div class="inside">
3749 3749
             <table class="form-table">
3750 3750
 				<tbody>
3751 3751
 				  <tr>
3752
-					<td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td>
3753
-					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td>
3752
+					<td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
3753
+					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td>
3754 3754
 				  </tr>
3755 3755
 				   <tr>
3756
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
3757
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
3756
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
3757
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
3758 3758
 				  </tr>
3759 3759
 				  <tr>
3760
-					<td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td>
3761
-					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e( 'Elapsed Time:', 'geodirectory' );?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
3760
+					<td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
3761
+					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e('Elapsed Time:', 'geodirectory'); ?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
3762 3762
 				  </tr>
3763 3763
 				  <tr class="gd-ie-actions">
3764 3764
 					<td style="vertical-align:top">
3765
-						<input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
3765
+						<input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
3766 3766
 					</td>
3767 3767
 					<td id="gd_ie_ex_files" class="gd-ie-files"></td>
3768 3768
 				  </tr>
@@ -3784,7 +3784,7 @@  discard block
 block discarded – undo
3784 3784
      * @param array $gd_chunksize_options File chunk size options.
3785 3785
      * @param string $nonce Wordpress security token for GD import & export.
3786 3786
 	 */
3787
-	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
3787
+	do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
3788 3788
 	?>
3789 3789
   </div>
3790 3790
 </div>
@@ -3803,7 +3803,7 @@  discard block
 block discarded – undo
3803 3803
 		jQuery.ajax({
3804 3804
 			url: ajaxurl,
3805 3805
 			type: "POST",
3806
-			data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>',
3806
+			data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>',
3807 3807
 			dataType: 'json',
3808 3808
 			cache: false,
3809 3809
 			success: function(data) {
@@ -3855,7 +3855,7 @@  discard block
 block discarded – undo
3855 3855
 
3856 3856
 		jQuery(cont).find('.filelist .file').remove();
3857 3857
 		
3858
-		jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
3858
+		jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
3859 3859
 		jQuery('#gd-import-msg', cont).show();
3860 3860
 		
3861 3861
 		return false;
@@ -3914,7 +3914,7 @@  discard block
 block discarded – undo
3914 3914
 	jQuery.ajax({
3915 3915
 		url: ajaxurl,
3916 3916
 		type: "POST",
3917
-		data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>',
3917
+		data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>',
3918 3918
 		dataType : 'json',
3919 3919
 		cache: false,
3920 3920
 		success: function (data) {
@@ -4090,27 +4090,27 @@  discard block
 block discarded – undo
4090 4090
 	
4091 4091
 	var gdMsg = '<p></p>';
4092 4092
 	if ( processed > 0 ) {
4093
-		var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>';
4093
+		var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
4094 4094
 		msgParse = msgParse.replace("%s", processed);
4095 4095
 		gdMsg += msgParse;
4096 4096
 	}
4097 4097
 	
4098 4098
 	if ( updated > 0 ) {
4099
-		var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>';
4099
+		var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
4100 4100
 		msgParse = msgParse.replace("%s", updated);
4101 4101
 		msgParse = msgParse.replace("%d", processed);
4102 4102
 		gdMsg += msgParse;
4103 4103
 	}
4104 4104
 	
4105 4105
 	if ( created > 0 ) {
4106
-		var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>';
4106
+		var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
4107 4107
 		msgParse = msgParse.replace("%s", created);
4108 4108
 		msgParse = msgParse.replace("%d", processed);
4109 4109
 		gdMsg += msgParse;
4110 4110
 	}
4111 4111
 	
4112 4112
 	if ( skipped > 0 ) {
4113
-		var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>';
4113
+		var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
4114 4114
 		msgParse = msgParse.replace("%s", skipped);
4115 4115
 		msgParse = msgParse.replace("%d", processed);
4116 4116
 		gdMsg += msgParse;
@@ -4120,21 +4120,21 @@  discard block
 block discarded – undo
4120 4120
 		if (type=='loc') {
4121 4121
 			invalid_addr = invalid;
4122 4122
 		}
4123
-		var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ), '%s', '%d' ) );?></p>';
4123
+		var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'), '%s', '%d')); ?></p>';
4124 4124
 		msgParse = msgParse.replace("%s", invalid_addr);
4125 4125
 		msgParse = msgParse.replace("%d", total);
4126 4126
 		gdMsg += msgParse;
4127 4127
 	}
4128 4128
 	
4129 4129
 	if (invalid > 0 && type!='loc') {
4130
-		var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank title/invalid post type.', 'geodirectory' ), '%s', '%d' ) );?></p>';
4130
+		var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank title/invalid post type.', 'geodirectory'), '%s', '%d')); ?></p>';
4131 4131
 		msgParse = msgParse.replace("%s", invalid);
4132 4132
 		msgParse = msgParse.replace("%d", total);
4133 4133
 		gdMsg += msgParse;
4134 4134
 	}
4135 4135
 	
4136 4136
 	if (images > 0) {
4137
-		gdMsg += '<p><?php echo addslashes( sprintf( CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'] ) );?></p>';
4137
+		gdMsg += '<p><?php echo addslashes(sprintf(CSV_TRANSFER_IMG_FOLDER, $uploads['subdir'])); ?></p>';
4138 4138
 	}
4139 4139
 	gdMsg += '<p></p>';
4140 4140
 	jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
@@ -4283,7 +4283,7 @@  discard block
 block discarded – undo
4283 4283
 		
4284 4284
 	function gd_process_export_posts(el, post_type, total_posts, chunk_size, pages, page) {
4285 4285
 		if (page < 2) {
4286
-			gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
4286
+			gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
4287 4287
 			jQuery(el).find('#gd_timer').text('00:00:01');
4288 4288
 			jQuery('#gd_ie_ex_files', el).html('');
4289 4289
 		}
@@ -4291,7 +4291,7 @@  discard block
 block discarded – undo
4291 4291
 		jQuery.ajax({
4292 4292
 			url: ajaxurl,
4293 4293
 			type: "POST",
4294
-			data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
4294
+			data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
4295 4295
 			dataType : 'json',
4296 4296
 			cache: false,
4297 4297
 			beforeSend: function (jqXHR, settings) {},
@@ -4305,11 +4305,11 @@  discard block
 block discarded – undo
4305 4305
 					} else {
4306 4306
 						if (pages < page || pages == page) {
4307 4307
 							window.clearInterval(timer_posts);
4308
-							gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
4308
+							gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
4309 4309
 						} else {
4310 4310
 							var percentage = Math.ceil(( page / pages ) * 100);
4311 4311
 							percentage = percentage > 100 ? 100 : percentage;
4312
-							gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
4312
+							gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
4313 4313
 						}
4314 4314
 						if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
4315 4315
 							var obj_files = data.files;
@@ -4339,7 +4339,7 @@  discard block
 block discarded – undo
4339 4339
 	
4340 4340
 	function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
4341 4341
 		if (page < 2) {
4342
-			gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
4342
+			gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
4343 4343
 			jQuery(el).find('#gd_timer').text('00:00:01');
4344 4344
 			jQuery('#gd_ie_ex_files', el).html('');
4345 4345
 		}
@@ -4347,7 +4347,7 @@  discard block
 block discarded – undo
4347 4347
 		jQuery.ajax({
4348 4348
 			url: ajaxurl,
4349 4349
 			type: "POST",
4350
-			data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
4350
+			data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
4351 4351
 			dataType : 'json',
4352 4352
 			cache: false,
4353 4353
 			beforeSend: function (jqXHR, settings) {},
@@ -4361,11 +4361,11 @@  discard block
 block discarded – undo
4361 4361
 					} else {
4362 4362
 						if (pages < page || pages == page) {
4363 4363
 							window.clearInterval(timer_cats);
4364
-							gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
4364
+							gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
4365 4365
 						} else {
4366 4366
 							var percentage = Math.ceil(( page / pages ) * 100);
4367 4367
 							percentage = percentage > 100 ? 100 : percentage;
4368
-							gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
4368
+							gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
4369 4369
 						}
4370 4370
 						if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
4371 4371
 							var obj_files = data.files;
@@ -4422,8 +4422,8 @@  discard block
 block discarded – undo
4422 4422
 function geodir_init_filesystem()
4423 4423
 {
4424 4424
 
4425
-    if(!function_exists('get_filesystem_method')){
4426
-        require_once(ABSPATH."/wp-admin/includes/file.php");
4425
+    if (!function_exists('get_filesystem_method')) {
4426
+        require_once(ABSPATH . "/wp-admin/includes/file.php");
4427 4427
     }
4428 4428
     $access_type = get_filesystem_method();
4429 4429
     if ($access_type === 'direct') {
@@ -4476,7 +4476,7 @@  discard block
 block discarded – undo
4476 4476
  * @package GeoDirectory
4477 4477
  */
4478 4478
 function geodir_filesystem_notice()
4479
-{   if ( defined( 'DOING_AJAX' ) ){return;}
4479
+{   if (defined('DOING_AJAX')) {return; }
4480 4480
     $access_type = get_filesystem_method();
4481 4481
     if ($access_type === 'direct') {
4482 4482
     } elseif (!defined('FTP_USER')) {
@@ -4513,61 +4513,61 @@  discard block
 block discarded – undo
4513 4513
     // try to set higher limits for import
4514 4514
     $max_input_time = ini_get('max_input_time');
4515 4515
     $max_execution_time = ini_get('max_execution_time');
4516
-    $memory_limit= ini_get('memory_limit');
4516
+    $memory_limit = ini_get('memory_limit');
4517 4517
 
4518
-    if(!$max_input_time || $max_input_time<3000){
4518
+    if (!$max_input_time || $max_input_time < 3000) {
4519 4519
         ini_set('max_input_time', 3000);
4520 4520
     }
4521 4521
 
4522
-    if(!$max_execution_time || $max_execution_time<3000){
4522
+    if (!$max_execution_time || $max_execution_time < 3000) {
4523 4523
         ini_set('max_execution_time', 3000);
4524 4524
     }
4525 4525
 
4526
-    if($memory_limit && str_replace('M','',$memory_limit)){
4527
-        if(str_replace('M','',$memory_limit)<256){
4526
+    if ($memory_limit && str_replace('M', '', $memory_limit)) {
4527
+        if (str_replace('M', '', $memory_limit) < 256) {
4528 4528
             ini_set('memory_limit', '256M');
4529 4529
         }
4530 4530
     }
4531 4531
 
4532 4532
     $json = array();
4533 4533
 
4534
-    if ( !current_user_can( 'manage_options' ) ) {
4535
-        wp_send_json( $json );
4534
+    if (!current_user_can('manage_options')) {
4535
+        wp_send_json($json);
4536 4536
     }
4537 4537
 
4538
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
4539
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
4540
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
4538
+    $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL;
4539
+    $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL;
4540
+    $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false;
4541 4541
 
4542
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
4543
-        wp_send_json( $json );
4542
+    if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
4543
+        wp_send_json($json);
4544 4544
     }
4545 4545
 
4546
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
4547
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
4546
+    $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL;
4547
+    $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL;
4548 4548
     $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
4549
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
4549
+    $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1;
4550 4550
 
4551 4551
     $wp_filesystem = geodir_init_filesystem();
4552 4552
     if (!$wp_filesystem) {
4553
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
4554
-        wp_send_json( $json );
4553
+        $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
4554
+        wp_send_json($json);
4555 4555
     }
4556 4556
 
4557 4557
     if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
4558
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
4559
-        wp_send_json( $json );
4558
+        $json['error'] = __('Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory');
4559
+        wp_send_json($json);
4560 4560
     }
4561 4561
 
4562
-    $csv_file_dir = geodir_path_import_export( false );
4563
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
4564
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
4565
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
4566
-            wp_send_json( $json );
4562
+    $csv_file_dir = geodir_path_import_export(false);
4563
+    if (!$wp_filesystem->is_dir($csv_file_dir)) {
4564
+        if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
4565
+            $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
4566
+            wp_send_json($json);
4567 4567
         }
4568 4568
     }
4569 4569
 
4570
-    switch ( $task ) {
4570
+    switch ($task) {
4571 4571
         case 'export_posts': {
4572 4572
             // WPML
4573 4573
             $is_wpml = geodir_is_wpml();
@@ -4578,12 +4578,12 @@  discard block
 block discarded – undo
4578 4578
                 $sitepress->switch_lang('all', true);
4579 4579
             }
4580 4580
             // WPML
4581
-            if ( $post_type == 'gd_event' ) {
4581
+            if ($post_type == 'gd_event') {
4582 4582
                 //add_filter( 'geodir_imex_count_posts', 'geodir_imex_count_events', 10, 2 );
4583
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
4583
+                add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
4584 4584
             }
4585
-            $file_name = $post_type . '_' . date( 'dmyHi' );
4586
-            $posts_count = geodir_get_posts_count( $post_type );
4585
+            $file_name = $post_type . '_' . date('dmyHi');
4586
+            $posts_count = geodir_get_posts_count($post_type);
4587 4587
             $file_url_base = geodir_path_import_export() . '/';
4588 4588
             $file_url = $file_url_base . $file_name . '.csv';
4589 4589
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
@@ -4591,10 +4591,10 @@  discard block
 block discarded – undo
4591 4591
             
4592 4592
             $chunk_file_paths = array();
4593 4593
 
4594
-            if ( isset( $_REQUEST['_st'] ) ) {
4595
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
4596
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
4597
-                $percentage = min( $percentage, 100 );
4594
+            if (isset($_REQUEST['_st'])) {
4595
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
4596
+                $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0;
4597
+                $percentage = min($percentage, 100);
4598 4598
                 
4599 4599
                 $json['percentage'] = $percentage;
4600 4600
                 // WPML
@@ -4602,49 +4602,49 @@  discard block
 block discarded – undo
4602 4602
                     $sitepress->switch_lang($active_lang, true);
4603 4603
                 }
4604 4604
                 // WPML
4605
-                wp_send_json( $json );
4605
+                wp_send_json($json);
4606 4606
                 exit;
4607 4607
             } else {				
4608
-                if ( !$posts_count > 0 ) {
4609
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
4608
+                if (!$posts_count > 0) {
4609
+                    $json['error'] = __('No records to export.', 'geodirectory');
4610 4610
                 } else {
4611 4611
                     $total_posts = $posts_count;
4612 4612
                     if ($chunk_per_page > $total_posts) {
4613 4613
                         $chunk_per_page = $total_posts;
4614 4614
                     }
4615
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
4615
+                    $chunk_total_pages = ceil($total_posts / $chunk_per_page);
4616 4616
                     
4617 4617
                     $j = $chunk_page_no;
4618
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
4618
+                    $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j);
4619 4619
                     
4620 4620
                     $per_page = 500;
4621 4621
                     if ($per_page > $chunk_per_page) {
4622 4622
                         $per_page = $chunk_per_page;
4623 4623
                     }
4624
-                    $total_pages = ceil( $chunk_per_page / $per_page );
4624
+                    $total_pages = ceil($chunk_per_page / $per_page);
4625 4625
                     
4626
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
4627
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
4626
+                    for ($i = 0; $i <= $total_pages; $i++) {
4627
+                        $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page);
4628 4628
                         
4629 4629
                         $clear = $i == 0 ? true : false;
4630
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
4630
+                        geodir_save_csv_data($file_path_temp, $save_posts, $clear);
4631 4631
                     }
4632 4632
                         
4633
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
4633
+                    if ($wp_filesystem->exists($file_path_temp)) {
4634 4634
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
4635 4635
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
4636 4636
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
4637
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
4637
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
4638 4638
                         
4639 4639
                         $file_url = $file_url_base . $chunk_file_name;
4640 4640
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4641 4641
                     }
4642 4642
                     
4643
-                    if ( !empty($chunk_file_paths) ) {
4643
+                    if (!empty($chunk_file_paths)) {
4644 4644
                         $json['total'] = $posts_count;
4645 4645
                         $json['files'] = $chunk_file_paths;
4646 4646
                     } else {
4647
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
4647
+                        $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
4648 4648
                     }
4649 4649
                 }
4650 4650
                 // WPML
@@ -4652,7 +4652,7 @@  discard block
 block discarded – undo
4652 4652
                     $sitepress->switch_lang($active_lang, true);
4653 4653
                 }
4654 4654
                 // WPML
4655
-                wp_send_json( $json );
4655
+                wp_send_json($json);
4656 4656
             }
4657 4657
         }
4658 4658
         break;
@@ -4666,9 +4666,9 @@  discard block
 block discarded – undo
4666 4666
                 $sitepress->switch_lang('all', true);
4667 4667
             }
4668 4668
             // WPML
4669
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
4669
+            $file_name = $post_type . 'category_' . date('dmyHi');
4670 4670
             
4671
-            $terms_count = geodir_get_terms_count( $post_type );
4671
+            $terms_count = geodir_get_terms_count($post_type);
4672 4672
             $file_url_base = geodir_path_import_export() . '/';
4673 4673
             $file_url = $file_url_base . $file_name . '.csv';
4674 4674
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
@@ -4676,10 +4676,10 @@  discard block
 block discarded – undo
4676 4676
             
4677 4677
             $chunk_file_paths = array();
4678 4678
             
4679
-            if ( isset( $_REQUEST['_st'] ) ) {
4680
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
4681
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
4682
-                $percentage = min( $percentage, 100 );
4679
+            if (isset($_REQUEST['_st'])) {
4680
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
4681
+                $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0;
4682
+                $percentage = min($percentage, 100);
4683 4683
                 
4684 4684
                 $json['percentage'] = $percentage;
4685 4685
                 // WPML
@@ -4687,48 +4687,48 @@  discard block
 block discarded – undo
4687 4687
                     $sitepress->switch_lang($active_lang, true);
4688 4688
                 }
4689 4689
                 // WPML
4690
-                wp_send_json( $json );
4690
+                wp_send_json($json);
4691 4691
             } else {				
4692
-                if ( !$terms_count > 0 ) {
4693
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
4692
+                if (!$terms_count > 0) {
4693
+                    $json['error'] = __('No records to export.', 'geodirectory');
4694 4694
                 } else {
4695 4695
                     $total_terms = $terms_count;
4696 4696
                     if ($chunk_per_page > $terms_count) {
4697 4697
                         $chunk_per_page = $terms_count;
4698 4698
                     }
4699
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
4699
+                    $chunk_total_pages = ceil($total_terms / $chunk_per_page);
4700 4700
                     
4701 4701
                     $j = $chunk_page_no;					
4702
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
4702
+                    $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j);
4703 4703
                     
4704 4704
                     $per_page = 500;
4705 4705
                     if ($per_page > $chunk_per_page) {
4706 4706
                         $per_page = $chunk_per_page;
4707 4707
                     }
4708
-                    $total_pages = ceil( $chunk_per_page / $per_page );
4708
+                    $total_pages = ceil($chunk_per_page / $per_page);
4709 4709
                     
4710
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
4711
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
4710
+                    for ($i = 0; $i <= $total_pages; $i++) {
4711
+                        $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page);
4712 4712
                         
4713 4713
                         $clear = $i == 0 ? true : false;
4714
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
4714
+                        geodir_save_csv_data($file_path_temp, $save_terms, $clear);
4715 4715
                     }
4716 4716
                     
4717
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
4717
+                    if ($wp_filesystem->exists($file_path_temp)) {
4718 4718
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
4719 4719
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
4720 4720
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
4721
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
4721
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
4722 4722
                         
4723 4723
                         $file_url = $file_url_base . $chunk_file_name;
4724 4724
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4725 4725
                     }
4726 4726
                     
4727
-                    if ( !empty($chunk_file_paths) ) {
4727
+                    if (!empty($chunk_file_paths)) {
4728 4728
                         $json['total'] = $terms_count;
4729 4729
                         $json['files'] = $chunk_file_paths;
4730 4730
                     } else {
4731
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
4731
+                        $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
4732 4732
                     }
4733 4733
                 }
4734 4734
                 // WPML
@@ -4736,67 +4736,67 @@  discard block
 block discarded – undo
4736 4736
                     $sitepress->switch_lang($active_lang, true);
4737 4737
                 }
4738 4738
                 // WPML
4739
-                wp_send_json( $json );
4739
+                wp_send_json($json);
4740 4740
             }
4741 4741
         }
4742 4742
         break;
4743 4743
         case 'export_locations': {
4744 4744
             $file_url_base = geodir_path_import_export() . '/';
4745
-            $file_name = 'gd_locations_' . date( 'dmyHi' );			
4745
+            $file_name = 'gd_locations_' . date('dmyHi');			
4746 4746
             $file_url = $file_url_base . $file_name . '.csv';
4747 4747
             $file_path = $csv_file_dir . '/' . $file_name . '.csv';
4748 4748
             $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
4749 4749
             
4750
-            $items_count = (int)geodir_location_imex_count_locations();
4750
+            $items_count = (int) geodir_location_imex_count_locations();
4751 4751
             
4752
-            if ( isset( $_REQUEST['_st'] ) ) {
4753
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
4754
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
4755
-                $percentage = min( $percentage, 100 );
4752
+            if (isset($_REQUEST['_st'])) {
4753
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
4754
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
4755
+                $percentage = min($percentage, 100);
4756 4756
                 
4757 4757
                 $json['percentage'] = $percentage;
4758
-                wp_send_json( $json );
4758
+                wp_send_json($json);
4759 4759
             } else {
4760 4760
                 $chunk_file_paths = array();
4761 4761
                 
4762
-                if ( !$items_count > 0 ) {
4763
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
4762
+                if (!$items_count > 0) {
4763
+                    $json['error'] = __('No records to export.', 'geodirectory');
4764 4764
                 } else {
4765
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
4766
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
4765
+                    $chunk_per_page = min($chunk_per_page, $items_count);
4766
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
4767 4767
                     
4768 4768
                     $j = $chunk_page_no;					
4769
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
4769
+                    $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j);
4770 4770
                     
4771 4771
                     $per_page = 500;
4772
-                    $per_page = min( $per_page, $chunk_per_page );
4773
-                    $total_pages = ceil( $chunk_per_page / $per_page );
4772
+                    $per_page = min($per_page, $chunk_per_page);
4773
+                    $total_pages = ceil($chunk_per_page / $per_page);
4774 4774
                     
4775
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
4776
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
4775
+                    for ($i = 0; $i <= $total_pages; $i++) {
4776
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
4777 4777
                         
4778 4778
                         $clear = $i == 0 ? true : false;
4779
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
4779
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
4780 4780
                     }
4781 4781
                     
4782
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
4782
+                    if ($wp_filesystem->exists($file_path_temp)) {
4783 4783
                         $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
4784 4784
                         $chunk_file_name = $file_name . $chunk_page_no . '.csv';
4785 4785
                         $file_path = $csv_file_dir . '/' . $chunk_file_name;
4786
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
4786
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
4787 4787
                         
4788 4788
                         $file_url = $file_url_base . $chunk_file_name;
4789 4789
                         $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
4790 4790
                     }
4791 4791
                     
4792
-                    if ( !empty($chunk_file_paths) ) {
4792
+                    if (!empty($chunk_file_paths)) {
4793 4793
                         $json['total'] = $items_count;
4794 4794
                         $json['files'] = $chunk_file_paths;
4795 4795
                     } else {
4796
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
4796
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
4797 4797
                     }
4798 4798
                 }
4799
-                wp_send_json( $json );
4799
+                wp_send_json($json);
4800 4800
             }
4801 4801
         }
4802 4802
         break;
@@ -4812,32 +4812,32 @@  discard block
 block discarded – undo
4812 4812
             }
4813 4813
             // WPML
4814 4814
             
4815
-            ini_set( 'auto_detect_line_endings', true );
4815
+            ini_set('auto_detect_line_endings', true);
4816 4816
             
4817 4817
             $uploads = wp_upload_dir();
4818 4818
             $uploads_dir = $uploads['path'];
4819 4819
             $uploads_subdir = $uploads['subdir'];
4820 4820
             
4821
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
4822
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
4821
+            $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL;
4822
+            $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip';
4823 4823
             
4824
-            $csv_file_arr = explode( '/', $csv_file );
4825
-            $csv_filename = end( $csv_file_arr );
4824
+            $csv_file_arr = explode('/', $csv_file);
4825
+            $csv_filename = end($csv_file_arr);
4826 4826
             $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
4827 4827
             
4828 4828
             $json['file'] = $csv_file;
4829
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
4829
+            $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
4830 4830
 
4831
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
4832
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
4831
+            if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
4832
+                $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename);
4833 4833
                 
4834 4834
                 if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4835 4835
                     $json['error'] = NULL;
4836 4836
                     $json['rows'] = 0;
4837 4837
                     
4838
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4839
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4840
-                            if ( !empty( $data ) ) {
4838
+                    if (($handle = fopen($target_path, "r")) !== FALSE) {
4839
+                        while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
4840
+                            if (!empty($data)) {
4841 4841
                                 $file[] = $data;
4842 4842
                             }
4843 4843
                         }
@@ -4850,19 +4850,19 @@  discard block
 block discarded – undo
4850 4850
                         $json['error'] = __('No data found in csv file.', 'geodirectory');
4851 4851
                     }
4852 4852
                 } else {
4853
-                    wp_send_json( $json );
4853
+                    wp_send_json($json);
4854 4854
                 }
4855 4855
             } else {
4856
-                wp_send_json( $json );
4856
+                wp_send_json($json);
4857 4857
             }
4858 4858
             
4859
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4860
-                wp_send_json( $json );
4859
+            if ($task == 'prepare_import' || !empty($json['error'])) {
4860
+                wp_send_json($json);
4861 4861
             }
4862 4862
             
4863 4863
             $total = $json['rows'];
4864
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4865
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4864
+            $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1;
4865
+            $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0;
4866 4866
             
4867 4867
             $count = $limit;
4868 4868
             $requested_limit = $limit;
@@ -4891,13 +4891,13 @@  discard block
 block discarded – undo
4891 4891
             
4892 4892
             $post_types = geodir_get_posttypes();
4893 4893
 
4894
-            if ( $task == 'import_cat' ) {				
4894
+            if ($task == 'import_cat') {				
4895 4895
                 if (!empty($file)) {
4896 4896
                     $columns = isset($file[0]) ? $file[0] : NULL;
4897 4897
                     
4898 4898
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4899 4899
                         $json['error'] = CSV_INVAILD_FILE;
4900
-                        wp_send_json( $json );
4900
+                        wp_send_json($json);
4901 4901
                         exit;
4902 4902
                     }
4903 4903
                     
@@ -4906,7 +4906,7 @@  discard block
 block discarded – undo
4906 4906
                         
4907 4907
                         if (isset($file[$index])) {
4908 4908
                             $row = $file[$index];
4909
-                            $row = array_map( 'trim', $row );
4909
+                            $row = array_map('trim', $row);
4910 4910
                             //$row = array_map( 'utf8_encode', $row );
4911 4911
                             
4912 4912
                             $cat_id = '';
@@ -4922,26 +4922,26 @@  discard block
 block discarded – undo
4922 4922
                             $cat_language = '';
4923 4923
                             
4924 4924
                             $c = 0;
4925
-                            foreach ($columns as $column ) {
4926
-                                if ( $column == 'cat_id' ) {
4927
-                                    $cat_id = (int)$row[$c];
4928
-                                } else if ( $column == 'cat_name' ) {
4925
+                            foreach ($columns as $column) {
4926
+                                if ($column == 'cat_id') {
4927
+                                    $cat_id = (int) $row[$c];
4928
+                                } else if ($column == 'cat_name') {
4929 4929
                                     $cat_name = $row[$c];
4930
-                                } else if ( $column == 'cat_slug' ) {
4930
+                                } else if ($column == 'cat_slug') {
4931 4931
                                     $cat_slug = $row[$c];
4932
-                                } else if ( $column == 'cat_posttype' ) {
4932
+                                } else if ($column == 'cat_posttype') {
4933 4933
                                     $cat_posttype = $row[$c];
4934
-                                } else if ( $column == 'cat_parent' ) {
4934
+                                } else if ($column == 'cat_parent') {
4935 4935
                                     $cat_parent = trim($row[$c]);
4936
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4936
+                                } else if ($column == 'cat_schema' && $row[$c] != '') {
4937 4937
                                     $cat_schema = $row[$c];
4938
-                                } else if ( $column == 'cat_description' ) {
4938
+                                } else if ($column == 'cat_description') {
4939 4939
                                     $cat_description = $row[$c];
4940
-                                } else if ( $column == 'cat_top_description' ) {
4940
+                                } else if ($column == 'cat_top_description') {
4941 4941
                                     $cat_top_description = $row[$c];
4942
-                                } else if ( $column == 'cat_image' ) {
4942
+                                } else if ($column == 'cat_image') {
4943 4943
                                     $cat_image = $row[$c];
4944
-                                } else if ( $column == 'cat_icon' ) {
4944
+                                } else if ($column == 'cat_icon') {
4945 4945
                                     $cat_icon = $row[$c];
4946 4946
                                 }
4947 4947
                                 // WPML
@@ -4952,7 +4952,7 @@  discard block
 block discarded – undo
4952 4952
                                 $c++;
4953 4953
                             }
4954 4954
                             
4955
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4955
+                            if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
4956 4956
                                 $invalid++;
4957 4957
                                 continue;
4958 4958
                             }
@@ -4969,8 +4969,8 @@  discard block
 block discarded – undo
4969 4969
                             $term_data['description'] = $cat_description;
4970 4970
                             $term_data['cat_schema'] = $cat_schema;
4971 4971
                             $term_data['top_description'] = $cat_top_description;
4972
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4973
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4972
+                            $term_data['image'] = $cat_image != '' ? basename($cat_image) : '';
4973
+                            $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : '';
4974 4974
                             
4975 4975
                             //$term_data = array_map( 'utf8_encode', $term_data );
4976 4976
                             
@@ -4979,14 +4979,14 @@  discard block
 block discarded – undo
4979 4979
                             $term_data['taxonomy'] = $taxonomy;
4980 4980
 
4981 4981
                             $term_parent_id = 0;
4982
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
4982
+                            if ($cat_parent != "" || (int) $cat_parent > 0) {
4983 4983
                                 $term_parent = '';
4984 4984
                                 
4985
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4985
+                                if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
4986 4986
                                     $term_parent = $term_parent;
4987
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4987
+                                } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
4988 4988
                                     $term_parent = $term_parent;
4989
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4989
+                                } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
4990 4990
                                     $term_parent = $term_parent;
4991 4991
                                 } else {
4992 4992
                                     $term_parent_data = array();
@@ -4994,47 +4994,47 @@  discard block
 block discarded – undo
4994 4994
                                     //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );										
4995 4995
                                     $term_parent_data['taxonomy'] = $taxonomy;
4996 4996
                                     
4997
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4997
+                                    $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data);
4998 4998
                                 }
4999 4999
                                 
5000
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
5001
-                                    $term_parent_id = (int)$term_parent->term_id;
5000
+                                if (!empty($term_parent) && !is_wp_error($term_parent)) {
5001
+                                    $term_parent_id = (int) $term_parent->term_id;
5002 5002
                                 }
5003 5003
                             }
5004
-                            $term_data['parent'] = (int)$term_parent_id;
5004
+                            $term_data['parent'] = (int) $term_parent_id;
5005 5005
 
5006 5006
                             $term_id = NULL;
5007
-                            if ( $import_choice == 'update' ) {
5008
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
5007
+                            if ($import_choice == 'update') {
5008
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
5009 5009
                                     $term_data['term_id'] = $term['term_id'];
5010 5010
                                     
5011
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
5011
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
5012 5012
                                         $updated++;
5013 5013
                                     } else {
5014 5014
                                         $invalid++;
5015 5015
                                     }
5016
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5016
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
5017 5017
                                     $term_data['term_id'] = $term['term_id'];
5018 5018
                                     
5019
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
5019
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
5020 5020
                                         $updated++;
5021 5021
                                     } else {
5022 5022
                                         $invalid++;
5023 5023
                                     }
5024 5024
                                 } else {
5025
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
5025
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
5026 5026
                                         $created++;
5027 5027
                                     } else {
5028 5028
                                         $invalid++;
5029 5029
                                     }
5030 5030
                                 }
5031
-                            } else if ( $import_choice == 'skip' ) {
5032
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
5031
+                            } else if ($import_choice == 'skip') {
5032
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
5033 5033
                                     $skipped++;
5034
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5034
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
5035 5035
                                     $skipped++;
5036 5036
                                 } else {
5037
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {										
5037
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {										
5038 5038
                                         $created++;
5039 5039
                                     } else {
5040 5040
                                         $invalid++;
@@ -5044,37 +5044,37 @@  discard block
 block discarded – undo
5044 5044
                                 $invalid++;
5045 5045
                             }
5046 5046
                             
5047
-                            if ( $term_id ) {
5048
-                                if ( isset( $term_data['top_description'] ) ) {
5049
-                                    update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
5047
+                            if ($term_id) {
5048
+                                if (isset($term_data['top_description'])) {
5049
+                                    update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype);
5050 5050
                                 }
5051 5051
                                 
5052
-                                if ( isset( $term_data['cat_schema'] ) ) {
5053
-                                    update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
5052
+                                if (isset($term_data['cat_schema'])) {
5053
+                                    update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype);
5054 5054
                                 }
5055 5055
             
5056 5056
                                 $attachment = false;
5057
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
5058
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
5059
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
5057
+                                if (isset($term_data['image']) && $term_data['image'] != '') {
5058
+                                    $cat_image = geodir_get_default_catimage($term_id, $cat_posttype);
5059
+                                    $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : '';
5060 5060
                                     
5061
-                                    if ( basename($cat_image) != $term_data['image'] ) {
5061
+                                    if (basename($cat_image) != $term_data['image']) {
5062 5062
                                         $attachment = true;
5063
-                                        update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
5063
+                                        update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image']), $cat_posttype);
5064 5064
                                     }
5065 5065
                                 }
5066 5066
                                 
5067
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
5068
-                                    $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
5069
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
5067
+                                if (isset($term_data['icon']) && $term_data['icon'] != '') {
5068
+                                    $cat_icon = get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype);
5069
+                                    $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
5070 5070
                                         
5071
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
5071
+                                    if (basename($cat_icon) != $term_data['icon']) {
5072 5072
                                         $attachment = true;
5073
-                                        update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
5073
+                                        update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon']), $cat_posttype);
5074 5074
                                     }
5075 5075
                                 }
5076 5076
                                 
5077
-                                if ( $attachment ) {
5077
+                                if ($attachment) {
5078 5078
                                     $images++;
5079 5079
                                 }
5080 5080
                             }
@@ -5096,14 +5096,14 @@  discard block
 block discarded – undo
5096 5096
                 $json['invalid'] = $invalid;
5097 5097
                 $json['images'] = $images;
5098 5098
                 
5099
-                wp_send_json( $json );
5099
+                wp_send_json($json);
5100 5100
                 exit;
5101
-            } else if ( $task == 'import_post' ) {
5101
+            } else if ($task == 'import_post') {
5102 5102
 
5103 5103
                 //run some stuff to make the import quicker
5104
-                wp_defer_term_counting( true );
5105
-                wp_defer_comment_counting( true );
5106
-                $wpdb->query( 'SET autocommit = 0;' );
5104
+                wp_defer_term_counting(true);
5105
+                wp_defer_comment_counting(true);
5106
+                $wpdb->query('SET autocommit = 0;');
5107 5107
 
5108 5108
                 //remove_all_actions('publish_post');
5109 5109
                 //remove_all_actions('transition_post_status');
@@ -5113,26 +5113,26 @@  discard block
 block discarded – undo
5113 5113
                 if (!empty($file)) {
5114 5114
                     $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
5115 5115
                     $default_status = 'publish';
5116
-                    $current_date = date_i18n( 'Y-m-d', time() );
5116
+                    $current_date = date_i18n('Y-m-d', time());
5117 5117
                     
5118 5118
                     $columns = isset($file[0]) ? $file[0] : NULL;
5119 5119
                     
5120 5120
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
5121 5121
                         $json['error'] = CSV_INVAILD_FILE;
5122
-                        wp_send_json( $json );
5122
+                        wp_send_json($json);
5123 5123
                         exit;
5124 5124
                     }
5125 5125
 
5126
-                    $processed_actual=0;
5126
+                    $processed_actual = 0;
5127 5127
                     for ($i = 1; $i <= $limit; $i++) {
5128 5128
                         $index = $processed + $i;
5129 5129
                         $gd_post = array();
5130 5130
                         
5131 5131
                         if (isset($file[$index])) {$processed_actual++;
5132 5132
                             $row = $file[$index];
5133
-                            $row = array_map( 'trim', $row );
5133
+                            $row = array_map('trim', $row);
5134 5134
                             //$row = array_map( 'utf8_encode', $row );
5135
-                            $row = array_map( 'addslashes_gpc', $row );
5135
+                            $row = array_map('addslashes_gpc', $row);
5136 5136
                             
5137 5137
                             $post_id = '';
5138 5138
                             $post_title = '';
@@ -5166,73 +5166,73 @@  discard block
 block discarded – undo
5166 5166
                             $original_post_id = '';
5167 5167
                                                         
5168 5168
                             $c = 0;
5169
-                            foreach ($columns as $column ) {
5169
+                            foreach ($columns as $column) {
5170 5170
                                 $gd_post[$column] = $row[$c];
5171 5171
                                 
5172
-                                if ( $column == 'post_id' ) {
5172
+                                if ($column == 'post_id') {
5173 5173
                                     $post_id = $row[$c];
5174
-                                } else if ( $column == 'post_title' ) {
5174
+                                } else if ($column == 'post_title') {
5175 5175
                                     $post_title = $row[$c];
5176
-                                } else if ( $column == 'post_author' ) {
5176
+                                } else if ($column == 'post_author') {
5177 5177
                                     $post_author = $row[$c];
5178
-                                } else if ( $column == 'post_content' ) {
5178
+                                } else if ($column == 'post_content') {
5179 5179
                                     $post_content = $row[$c];
5180
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
5181
-                                    $post_category_arr = explode( ',', $row[$c] );
5182
-                                } else if ( $column == 'default_category' ) {
5180
+                                } else if ($column == 'post_category' && $row[$c] != '') {
5181
+                                    $post_category_arr = explode(',', $row[$c]);
5182
+                                } else if ($column == 'default_category') {
5183 5183
                                     $default_category = wp_kses_normalize_entities($row[$c]);
5184
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
5185
-                                    $post_tags = explode( ',', $row[$c] );
5186
-                                } else if ( $column == 'post_type' ) {
5184
+                                } else if ($column == 'post_tags' && $row[$c] != '') {
5185
+                                    $post_tags = explode(',', $row[$c]);
5186
+                                } else if ($column == 'post_type') {
5187 5187
                                     $post_type = $row[$c];
5188
-                                } else if ( $column == 'post_status' ) {
5189
-                                    $post_status = sanitize_key( $row[$c] );
5190
-                                } else if ( $column == 'is_featured' ) {
5191
-                                    $is_featured = (int)$row[$c];
5192
-                                } else if ( $column == 'geodir_video' ) {
5188
+                                } else if ($column == 'post_status') {
5189
+                                    $post_status = sanitize_key($row[$c]);
5190
+                                } else if ($column == 'is_featured') {
5191
+                                    $is_featured = (int) $row[$c];
5192
+                                } else if ($column == 'geodir_video') {
5193 5193
                                     $geodir_video = $row[$c];
5194
-                                } else if ( $column == 'post_address' ) {
5194
+                                } else if ($column == 'post_address') {
5195 5195
                                     $post_address = $row[$c];
5196
-                                } else if ( $column == 'post_city' ) {
5196
+                                } else if ($column == 'post_city') {
5197 5197
                                     $post_city = $row[$c];
5198
-                                } else if ( $column == 'post_region' ) {
5198
+                                } else if ($column == 'post_region') {
5199 5199
                                     $post_region = $row[$c];
5200
-                                } else if ( $column == 'post_country' ) {
5200
+                                } else if ($column == 'post_country') {
5201 5201
                                     $post_country = $row[$c];
5202
-                                } else if ( $column == 'post_zip' ) {
5202
+                                } else if ($column == 'post_zip') {
5203 5203
                                     $post_zip = $row[$c];
5204
-                                } else if ( $column == 'post_latitude' ) {
5204
+                                } else if ($column == 'post_latitude') {
5205 5205
                                     $post_latitude = $row[$c];
5206
-                                } else if ( $column == 'post_longitude' ) {
5206
+                                } else if ($column == 'post_longitude') {
5207 5207
                                     $post_longitude = $row[$c];
5208
-                                } else if ( $column == 'geodir_timing' ) {
5208
+                                } else if ($column == 'geodir_timing') {
5209 5209
                                     $geodir_timing = $row[$c];
5210
-                                } else if ( $column == 'geodir_contact' ) {
5210
+                                } else if ($column == 'geodir_contact') {
5211 5211
                                     $geodir_contact = $row[$c];
5212
-                                } else if ( $column == 'geodir_email' ) {
5212
+                                } else if ($column == 'geodir_email') {
5213 5213
                                     $geodir_email = $row[$c];
5214
-                                } else if ( $column == 'geodir_website' ) {
5214
+                                } else if ($column == 'geodir_website') {
5215 5215
                                     $geodir_website = $row[$c];
5216
-                                } else if ( $column == 'geodir_twitter' ) {
5216
+                                } else if ($column == 'geodir_twitter') {
5217 5217
                                     $geodir_twitter = $row[$c];
5218
-                                } else if ( $column == 'geodir_facebook' ) {
5218
+                                } else if ($column == 'geodir_facebook') {
5219 5219
                                     $geodir_facebook = $row[$c];
5220
-                                } else if ( $column == 'geodir_twitter' ) {
5220
+                                } else if ($column == 'geodir_twitter') {
5221 5221
                                     $geodir_twitter = $row[$c];
5222
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
5222
+                                } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
5223 5223
                                     $post_images[] = $row[$c];
5224
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
5225
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
5226
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
5224
+                                } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
5225
+                                    $expire_date = date_i18n('Y-m-d', strtotime($current_date . '+' . (int) $row[$c] . ' days'));
5226
+                                } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
5227 5227
                                     $row[$c] = str_replace('/', '-', $row[$c]);
5228
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
5228
+                                    $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
5229 5229
                                 }
5230 5230
                                 // WPML
5231 5231
                                 if ($is_wpml) {
5232 5232
                                     if ($column == 'language') {
5233 5233
                                         $language = geodir_strtolower(trim($row[$c]));
5234 5234
                                     } else if ($column == 'original_post_id') {
5235
-                                        $original_post_id = (int)$row[$c];
5235
+                                        $original_post_id = (int) $row[$c];
5236 5236
                                     }
5237 5237
                                 }
5238 5238
                                 // WPML
@@ -5247,24 +5247,24 @@  discard block
 block discarded – undo
5247 5247
 
5248 5248
                             $gd_post['IMAGE'] = $post_images;
5249 5249
                             
5250
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
5251
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
5250
+                            $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
5251
+                            $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
5252 5252
                                                                                                                 
5253 5253
                             $valid = true;
5254 5254
                             
5255
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
5255
+                            if ($post_title == '' || !in_array($post_type, $post_types)) {
5256 5256
                                 $invalid++;
5257 5257
                                 $valid = false;
5258 5258
                             }
5259 5259
                             
5260
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5261
-                            if ( $location_allowed ) {
5260
+                            $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
5261
+                            if ($location_allowed) {
5262 5262
                                 $location_result = geodir_get_default_location();
5263
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
5263
+                                if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
5264 5264
                                     $invalid_addr++;
5265 5265
                                     $valid = false;
5266
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
5267
-                                    if ( ( geodir_strtolower( $post_city ) != geodir_strtolower( $location_result->city ) ) || ( geodir_strtolower( $post_region ) != geodir_strtolower( $location_result->region ) ) || (geodir_strtolower( $post_country ) != geodir_strtolower( $location_result->country ) ) ) {
5266
+                                } else if (!empty($location_result) && $location_result->location_id == 0) {
5267
+                                    if ((geodir_strtolower($post_city) != geodir_strtolower($location_result->city)) || (geodir_strtolower($post_region) != geodir_strtolower($location_result->region)) || (geodir_strtolower($post_country) != geodir_strtolower($location_result->country))) {
5268 5268
                                         $invalid_addr++;
5269 5269
                                         $valid = false;
5270 5270
                                     } else {
@@ -5275,7 +5275,7 @@  discard block
 block discarded – undo
5275 5275
                                 }
5276 5276
                             }
5277 5277
                             
5278
-                            if ( !$valid ) {
5278
+                            if (!$valid) {
5279 5279
                                 continue;
5280 5280
                             }
5281 5281
 
@@ -5288,16 +5288,16 @@  discard block
 block discarded – undo
5288 5288
 
5289 5289
                             $post_category = array();
5290 5290
                             $default_category_id = NULL;
5291
-                            if ( !empty( $post_category_arr ) ) {
5292
-                                foreach ( $post_category_arr as $value ) {
5293
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
5291
+                            if (!empty($post_category_arr)) {
5292
+                                foreach ($post_category_arr as $value) {
5293
+                                    $category_name = wp_kses_normalize_entities(trim($value));
5294 5294
                                     
5295
-                                    if ( $category_name != '' ) {
5295
+                                    if ($category_name != '') {
5296 5296
                                         $term_category = array();
5297 5297
                                         
5298
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
5298
+                                        if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
5299 5299
                                             $term_category = $term;
5300
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
5300
+                                        } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
5301 5301
                                             $term_category = $term;
5302 5302
                                         } else {
5303 5303
                                             $term_data = array();
@@ -5305,13 +5305,13 @@  discard block
 block discarded – undo
5305 5305
                                             //$term_data = array_map( 'utf8_encode', $term_data );										
5306 5306
                                             $term_data['taxonomy'] = $cat_taxonomy;
5307 5307
                                             
5308
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
5309
-                                            if ( $term_id ) {
5310
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
5308
+                                            $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data);
5309
+                                            if ($term_id) {
5310
+                                                $term_category = get_term($term_id, $cat_taxonomy);
5311 5311
                                             }
5312 5312
                                         }
5313 5313
                                         
5314
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
5314
+                                        if (!empty($term_category) && !is_wp_error($term_category)) {
5315 5315
                                             //$post_category[] = $term_category->slug;
5316 5316
                                             $post_category[] = intval($term_category->term_id);
5317 5317
                                             
@@ -5333,28 +5333,28 @@  discard block
 block discarded – undo
5333 5333
                             $save_post['post_tags'] = $post_tags;
5334 5334
 
5335 5335
                             $saved_post_id = NULL;
5336
-                            if ( $import_choice == 'update' ) {
5337
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
5336
+                            if ($import_choice == 'update') {
5337
+                                if ($post_id > 0 && get_post($post_id)) {
5338 5338
                                     $save_post['ID'] = $post_id;
5339 5339
                                     
5340
-                                    if ( wp_update_post( $save_post ) ) {
5340
+                                    if (wp_update_post($save_post)) {
5341 5341
                                         $saved_post_id = $post_id;
5342 5342
                                         $updated++;
5343 5343
                                     }
5344 5344
                                 } else {
5345
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
5345
+                                    if ($saved_post_id = wp_insert_post($save_post)) {
5346 5346
                                         $created++;
5347 5347
                                     }
5348 5348
                                 }
5349 5349
                                 
5350
-                                if ( !$saved_post_id > 0 ) {
5350
+                                if (!$saved_post_id > 0) {
5351 5351
                                     $invalid++;
5352 5352
                                 }
5353
-                            } else if ( $import_choice == 'skip' ) {
5354
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
5353
+                            } else if ($import_choice == 'skip') {
5354
+                                if ($post_id > 0 && get_post($post_id)) {
5355 5355
                                     $skipped++;	
5356 5356
                                 } else {
5357
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
5357
+                                    if ($saved_post_id = wp_insert_post($save_post)) {
5358 5358
                                         $created++;	
5359 5359
                                     } else {
5360 5360
                                         $invalid++;
@@ -5364,19 +5364,19 @@  discard block
 block discarded – undo
5364 5364
                                 $invalid++;
5365 5365
                             }
5366 5366
 
5367
-                            if ( (int)$saved_post_id > 0 ) {
5367
+                            if ((int) $saved_post_id > 0) {
5368 5368
                                 // WPML
5369 5369
                                 if ($is_wpml && $original_post_id > 0 && $language != '') {
5370 5370
                                     $wpml_post_type = 'post_' . $post_type;
5371
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
5371
+                                    $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type);
5372 5372
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
5373 5373
 
5374
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
5374
+                                    $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type);
5375 5375
                                     
5376
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
5376
+                                    $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language);
5377 5377
                                 }
5378 5378
                                 // WPML
5379
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
5379
+                                $gd_post_info = geodir_get_post_info($saved_post_id);
5380 5380
                                 
5381 5381
                                 $gd_post['post_id'] = $saved_post_id;
5382 5382
                                 $gd_post['ID'] = $saved_post_id;
@@ -5388,7 +5388,7 @@  discard block
 block discarded – undo
5388 5388
                                                     
5389 5389
                                 // post location
5390 5390
                                 $post_location_id = 0;
5391
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
5391
+                                if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
5392 5392
                                     $post_location_info = array(
5393 5393
                                                                 'city' => $post_city,
5394 5394
                                                                 'region' => $post_region,
@@ -5396,21 +5396,21 @@  discard block
 block discarded – undo
5396 5396
                                                                 'geo_lat' => $post_latitude,
5397 5397
                                                                 'geo_lng' => $post_longitude
5398 5398
                                                             );
5399
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
5399
+                                    if ($location_id = (int) geodir_add_new_location($post_location_info)) {
5400 5400
                                         $post_location_id = $location_id;
5401 5401
                                     }
5402 5402
                                 }
5403 5403
                                 $gd_post['post_location_id'] = $post_location_id;
5404 5404
                                 
5405 5405
                                 // post package info
5406
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
5406
+                                $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0;
5407 5407
                                 if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
5408 5408
                                     $package_id = $gd_post_info->package_id;
5409 5409
                                 }
5410 5410
                                 
5411 5411
                                 $package_info = array();
5412 5412
                                 if ($package_id && function_exists('geodir_get_package_info_by_id')) {
5413
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
5413
+                                    $package_info = (array) geodir_get_package_info_by_id($package_id);
5414 5414
                                     
5415 5415
                                     if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
5416 5416
                                         $package_info = array();
@@ -5418,18 +5418,18 @@  discard block
 block discarded – undo
5418 5418
                                 }
5419 5419
                                 
5420 5420
                                 if (empty($package_info)) {
5421
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
5421
+                                    $package_info = (array) geodir_post_package_info(array(), '', $post_type);
5422 5422
                                 }
5423 5423
                                  
5424
-                                if (!empty($package_info))	 {
5424
+                                if (!empty($package_info)) {
5425 5425
                                     $package_id = $package_info['pid'];
5426 5426
                                     
5427 5427
                                     if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
5428 5428
                                         $gd_post['expire_date'] = $expire_date;
5429 5429
                                     } else {
5430
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
5431
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
5432
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
5430
+                                        if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
5431
+                                            $gd_post['alive_days'] = (int) $package_info['days'];
5432
+                                            $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date . '+' . (int) $package_info['days'] . ' days'));
5433 5433
                                         } else {
5434 5434
                                             $gd_post['expire_date'] = 'Never';
5435 5435
                                         }
@@ -5449,28 +5449,28 @@  discard block
 block discarded – undo
5449 5449
                                 }
5450 5450
 
5451 5451
                                 // Export franchise fields
5452
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5452
+                                $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
5453 5453
                                 if ($is_franchise_active) {
5454
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
5454
+                                    if (isset($gd_post['gd_is_franchise']) && (int) $gd_post['gd_is_franchise'] == 1) {
5455 5455
                                         $gd_franchise_lock = array();
5456 5456
                                         
5457
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
5458
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
5459
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
5460
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
5457
+                                        if (isset($gd_post['gd_franchise_lock'])) {
5458
+                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
5459
+                                            $gd_franchise_lock = trim($gd_franchise_lock);
5460
+                                            $gd_franchise_lock = explode(",", $gd_franchise_lock);
5461 5461
                                         }
5462 5462
                                         
5463
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
5464
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
5463
+                                        update_post_meta($saved_post_id, 'gd_is_franchise', 1);
5464
+                                        update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock);
5465 5465
                                     } else {
5466
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
5467
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
5466
+                                        if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
5467
+                                            geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']);
5468 5468
                                         }
5469 5469
                                     }
5470 5470
                                 }
5471 5471
                                 
5472 5472
                                 if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
5473
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
5473
+                                    $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
5474 5474
                                     if ($default_category_id) {
5475 5475
                                         $save_post['post_default_category'] = $default_category_id;
5476 5476
                                         $gd_post['default_category'] = $default_category_id;
@@ -5479,12 +5479,12 @@  discard block
 block discarded – undo
5479 5479
                                 }
5480 5480
                                 
5481 5481
                                 // Save post info
5482
-                                geodir_save_post_info( $saved_post_id, $gd_post );
5482
+                                geodir_save_post_info($saved_post_id, $gd_post);
5483 5483
                                 // post taxonomies
5484
-                                if ( !empty( $save_post['post_category'] ) ) {
5485
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
5484
+                                if (!empty($save_post['post_category'])) {
5485
+                                    wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy);
5486 5486
                                     
5487
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
5487
+                                    $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : '';
5488 5488
                                     if ($default_category_id) {
5489 5489
                                         $post_default_category = $default_category_id;
5490 5490
                                     }
@@ -5498,15 +5498,15 @@  discard block
 block discarded – undo
5498 5498
                                     
5499 5499
                                     $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
5500 5500
                                     
5501
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
5501
+                                    geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str);
5502 5502
                                 }
5503 5503
 
5504
-                                if ( !empty( $save_post['post_tags'] ) ) {
5505
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
5504
+                                if (!empty($save_post['post_tags'])) {
5505
+                                    wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy);
5506 5506
                                 }
5507 5507
 
5508 5508
                                 // Post images
5509
-                                if ( !empty( $post_images ) ) {
5509
+                                if (!empty($post_images)) {
5510 5510
                                     $post_images = array_unique($post_images);
5511 5511
                                     
5512 5512
                                     $old_post_images_arr = array();
@@ -5514,30 +5514,30 @@  discard block
 block discarded – undo
5514 5514
                                     
5515 5515
                                     $order = 1;
5516 5516
                                     
5517
-                                    $old_post_images = geodir_get_images( $saved_post_id );
5517
+                                    $old_post_images = geodir_get_images($saved_post_id);
5518 5518
                                     if (!empty($old_post_images)) {
5519
-                                        foreach( $old_post_images as $old_post_image ) {
5519
+                                        foreach ($old_post_images as $old_post_image) {
5520 5520
                                             if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
5521 5521
                                                 $old_post_images_arr[] = $old_post_image->file;
5522 5522
                                             }
5523 5523
                                         }
5524 5524
                                     }
5525 5525
                                     
5526
-                                    foreach ( $post_images as $post_image ) {
5527
-                                        $image_name = basename( $post_image );
5526
+                                    foreach ($post_images as $post_image) {
5527
+                                        $image_name = basename($post_image);
5528 5528
                                         $saved_post_images_arr[] = $image_name;
5529 5529
                                         
5530
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
5530
+                                        if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
5531 5531
                                             continue; // Skip if image already exists.
5532 5532
                                         }
5533 5533
                                         
5534
-                                        $image_name_parts = explode( '.', $image_name );
5535
-                                        array_pop( $image_name_parts );
5536
-                                        $proper_image_name = implode( '.', $image_name_parts );
5534
+                                        $image_name_parts = explode('.', $image_name);
5535
+                                        array_pop($image_name_parts);
5536
+                                        $proper_image_name = implode('.', $image_name_parts);
5537 5537
                                         
5538
-                                        $arr_file_type = wp_check_filetype( $image_name );
5538
+                                        $arr_file_type = wp_check_filetype($image_name);
5539 5539
                                         
5540
-                                        if ( !empty( $arr_file_type ) ) {
5540
+                                        if (!empty($arr_file_type)) {
5541 5541
                                             $uploaded_file_type = $arr_file_type['type'];
5542 5542
                                             
5543 5543
                                             $attachment = array();
@@ -5550,46 +5550,46 @@  discard block
 block discarded – undo
5550 5550
                                             $attachment['is_featured'] = 0;
5551 5551
 
5552 5552
                                             $attachment_set = '';
5553
-                                            foreach ( $attachment as $key => $val ) {
5554
-                                                if ( $val != '' ) {
5553
+                                            foreach ($attachment as $key => $val) {
5554
+                                                if ($val != '') {
5555 5555
                                                     $attachment_set .= $key . " = '" . $val . "', ";
5556 5556
                                                 }
5557 5557
                                             }
5558
-                                            $attachment_set = trim( $attachment_set, ", " );
5558
+                                            $attachment_set = trim($attachment_set, ", ");
5559 5559
                                                                                         
5560 5560
                                             // Add new attachment
5561
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
5561
+                                            $wpdb->query("INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set);
5562 5562
                                                                                         
5563 5563
                                             $order++;
5564 5564
                                         }
5565 5565
                                     }
5566 5566
 
5567
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
5567
+                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/", $saved_post_images_arr) . "' )" : '';
5568 5568
                                     // Remove previous attachment
5569
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
5569
+                                    $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int) $saved_post_id . " " . $saved_post_images_sql);
5570 5570
                                     
5571
-                                    if ( !empty( $saved_post_images_arr ) ) {
5571
+                                    if (!empty($saved_post_images_arr)) {
5572 5572
                                         $menu_order = 1;
5573 5573
                                         
5574
-                                        foreach ( $saved_post_images_arr as $img_name ) {
5575
-                                            $wpdb->query( $wpdb->prepare( "UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array( $menu_order, $saved_post_id, '%/' . $img_name ) ) );
5574
+                                        foreach ($saved_post_images_arr as $img_name) {
5575
+                                            $wpdb->query($wpdb->prepare("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order = %d WHERE post_id =%d AND file LIKE %s", array($menu_order, $saved_post_id, '%/' . $img_name)));
5576 5576
                                             
5577
-                                            if( $menu_order == 1 ) {
5578
-                                                if ( $featured_image = $wpdb->get_var( $wpdb->prepare( "SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array( $saved_post_id, '%/' . $img_name ) ) ) ) {
5579
-                                                    $wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
5577
+                                            if ($menu_order == 1) {
5578
+                                                if ($featured_image = $wpdb->get_var($wpdb->prepare("SELECT file FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =%d AND file LIKE %s", array($saved_post_id, '%/' . $img_name)))) {
5579
+                                                    $wpdb->query($wpdb->prepare("UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array($featured_image, $saved_post_id)));
5580 5580
                                                 }
5581 5581
                                             }
5582 5582
                                             $menu_order++;
5583 5583
                                         }
5584 5584
                                     }
5585 5585
                                     
5586
-                                    if ( $order > 1 ) {
5586
+                                    if ($order > 1) {
5587 5587
                                         $images++;
5588 5588
                                     }
5589 5589
                                 }
5590 5590
 
5591 5591
                                 /** This action is documented in geodirectory-functions/post-functions.php */
5592
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
5592
+                                do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
5593 5593
                                 
5594 5594
                                 if (isset($is_featured)) {
5595 5595
                                     geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
@@ -5609,10 +5609,10 @@  discard block
 block discarded – undo
5609 5609
                 }
5610 5610
 
5611 5611
                 //undo some stuff to make the import quicker
5612
-                wp_defer_term_counting( false );
5613
-                wp_defer_comment_counting( false );
5614
-                $wpdb->query( 'COMMIT;' );
5615
-                $wpdb->query( 'SET autocommit = 1;' );
5612
+                wp_defer_term_counting(false);
5613
+                wp_defer_comment_counting(false);
5614
+                $wpdb->query('COMMIT;');
5615
+                $wpdb->query('SET autocommit = 1;');
5616 5616
 
5617 5617
                 $json = array();
5618 5618
                 $json['processed'] = $processed_actual;
@@ -5623,9 +5623,9 @@  discard block
 block discarded – undo
5623 5623
                 $json['invalid_addr'] = $invalid_addr;
5624 5624
                 $json['images'] = $images;
5625 5625
                 
5626
-                wp_send_json( $json );
5626
+                wp_send_json($json);
5627 5627
                 exit;
5628
-            } else if ( $task == 'import_loc' ) {
5628
+            } else if ($task == 'import_loc') {
5629 5629
                 global $gd_post_types;
5630 5630
                 $gd_post_types = $post_types;
5631 5631
                 
@@ -5634,7 +5634,7 @@  discard block
 block discarded – undo
5634 5634
                     
5635 5635
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
5636 5636
                         $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
5637
-                        wp_send_json( $json );
5637
+                        wp_send_json($json);
5638 5638
                     }
5639 5639
                     
5640 5640
                     for ($i = 1; $i <= $limit; $i++) {
@@ -5642,59 +5642,59 @@  discard block
 block discarded – undo
5642 5642
                         
5643 5643
                         if (isset($file[$index])) {
5644 5644
                             $row = $file[$index];
5645
-                            $row = array_map( 'trim', $row );
5645
+                            $row = array_map('trim', $row);
5646 5646
                             $data = array();
5647 5647
                             
5648
-                            foreach ($columns as $c => $column ) {
5648
+                            foreach ($columns as $c => $column) {
5649 5649
                                 if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta', 'city_desc', 'region_meta', 'region_desc', 'country_meta', 'country_desc'))) {
5650 5650
                                     $data[$column] = $row[$c];
5651 5651
                                 }
5652 5652
                             }
5653 5653
 
5654
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
5654
+                            if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
5655 5655
                                 $invalid++;
5656 5656
                                 continue;
5657 5657
                             }
5658 5658
                             
5659 5659
                             $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
5660 5660
                             
5661
-                            if ( $import_choice == 'update' ) {
5662
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
5663
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
5661
+                            if ($import_choice == 'update') {
5662
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
5663
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
5664 5664
                                         $updated++;
5665 5665
                                     } else {
5666 5666
                                         $invalid++;
5667 5667
                                     }
5668
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
5669
-                                    $data['location_id'] = (int)$location->location_id;
5668
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
5669
+                                    $data['location_id'] = (int) $location->location_id;
5670 5670
                                     
5671
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
5672
-                                        $data['location_id'] = (int)$location->location_id;
5673
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
5674
-                                        $data['location_id'] = (int)$location->location_id;
5675
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
5676
-                                        $data['location_id'] = (int)$location->location_id;
5671
+                                    if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
5672
+                                        $data['location_id'] = (int) $location->location_id;
5673
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
5674
+                                        $data['location_id'] = (int) $location->location_id;
5675
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
5676
+                                        $data['location_id'] = (int) $location->location_id;
5677 5677
                                     }
5678 5678
                                     
5679
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
5679
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
5680 5680
                                         $updated++;
5681 5681
                                     } else {
5682 5682
                                         $invalid++;
5683 5683
                                     }
5684 5684
                                 } else {
5685
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
5685
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
5686 5686
                                         $created++;
5687 5687
                                     } else {
5688 5688
                                         $invalid++;
5689 5689
                                     }
5690 5690
                                 }
5691
-                            } elseif ( $import_choice == 'skip' ) {
5692
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
5691
+                            } elseif ($import_choice == 'skip') {
5692
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
5693 5693
                                     $skipped++;
5694
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
5694
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
5695 5695
                                     $skipped++;
5696 5696
                                 } else {
5697
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {										
5697
+                                    if ($location_id = geodir_location_insert_city($data, true)) {										
5698 5698
                                         $created++;
5699 5699
                                     } else {
5700 5700
                                         $invalid++;
@@ -5715,7 +5715,7 @@  discard block
 block discarded – undo
5715 5715
                 $json['invalid'] = $invalid;
5716 5716
                 $json['images'] = $images;
5717 5717
                 
5718
-                wp_send_json( $json );
5718
+                wp_send_json($json);
5719 5719
             }
5720 5720
         }
5721 5721
         break;
@@ -5759,29 +5759,29 @@  discard block
 block discarded – undo
5759 5759
  * }
5760 5760
  * @return int|bool Term id when success, false when fail.
5761 5761
  */
5762
-function geodir_imex_insert_term( $taxonomy, $term_data ) {
5763
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5762
+function geodir_imex_insert_term($taxonomy, $term_data) {
5763
+	if (empty($taxonomy) || empty($term_data)) {
5764 5764
 		return false;
5765 5765
 	}
5766 5766
 	
5767
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5767
+	$term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
5768 5768
 	$args = array();
5769
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5770
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5771
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5769
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
5770
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
5771
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
5772 5772
 	
5773
-	if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
5774
-		$term_args = array_merge( $term_data, $args );
5775
-		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5776
-		$term_args = wp_parse_args( $term_args, $defaults );
5777
-		$term_args = sanitize_term( $term_args, $taxonomy, 'db' );
5778
-		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5773
+	if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
5774
+		$term_args = array_merge($term_data, $args);
5775
+		$defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
5776
+		$term_args = wp_parse_args($term_args, $defaults);
5777
+		$term_args = sanitize_term($term_args, $taxonomy, 'db');
5778
+		$args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args);
5779 5779
 	}
5780 5780
 	
5781
-    if( !empty( $term ) ) {
5782
-		$result = wp_insert_term( $term, $taxonomy, $args );
5783
-        if( !is_wp_error( $result ) ) {
5784
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5781
+    if (!empty($term)) {
5782
+		$result = wp_insert_term($term, $taxonomy, $args);
5783
+        if (!is_wp_error($result)) {
5784
+            return $term_id = isset($result['term_id']) ? $result['term_id'] : 0;
5785 5785
         }
5786 5786
     }
5787 5787
 	
@@ -5811,37 +5811,37 @@  discard block
 block discarded – undo
5811 5811
  * }
5812 5812
  * @return int|bool Term id when success, false when fail.
5813 5813
  */
5814
-function geodir_imex_update_term( $taxonomy, $term_data ) {
5815
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
5814
+function geodir_imex_update_term($taxonomy, $term_data) {
5815
+	if (empty($taxonomy) || empty($term_data)) {
5816 5816
 		return false;
5817 5817
 	}
5818 5818
 	
5819
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
5820
-	$term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
5819
+	$term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
5820
+	$term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0;
5821 5821
 	
5822 5822
 	$args = array();
5823
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
5824
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
5825
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
5823
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
5824
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
5825
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
5826 5826
 	
5827
-	if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
5827
+	if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
5828 5828
 		$term_data['term_id'] = $term_info['term_id'];
5829 5829
 		
5830
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5830
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5831 5831
 		
5832
-		if( !is_wp_error( $result ) ) {
5833
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5832
+		if (!is_wp_error($result)) {
5833
+            return $term_id = isset($result['term_id']) ? $result['term_id'] : 0;
5834 5834
         }
5835
-	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5835
+	} else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
5836 5836
 		$term_data['term_id'] = $term_info['term_id'];
5837 5837
 		
5838
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5838
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5839 5839
 		
5840
-		if( !is_wp_error( $result ) ) {
5841
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5840
+		if (!is_wp_error($result)) {
5841
+            return $term_id = isset($result['term_id']) ? $result['term_id'] : 0;
5842 5842
         }
5843 5843
 	} else {
5844
-		return geodir_imex_insert_term( $taxonomy, $term_data );
5844
+		return geodir_imex_insert_term($taxonomy, $term_data);
5845 5845
 	}
5846 5846
 	
5847 5847
 	return false;
@@ -5856,9 +5856,9 @@  discard block
 block discarded – undo
5856 5856
  * @param string $post_type Post type.
5857 5857
  * @return int Posts count.
5858 5858
  */
5859
-function geodir_get_posts_count( $post_type ) {
5860
-	$posts_count = wp_count_posts( $post_type );
5861
-	$posts_count = array_sum( (array)$posts_count );
5859
+function geodir_get_posts_count($post_type) {
5860
+	$posts_count = wp_count_posts($post_type);
5861
+	$posts_count = array_sum((array) $posts_count);
5862 5862
 	
5863 5863
 	/**
5864 5864
 	 * Modify returned post counts for the current post type.
@@ -5869,7 +5869,7 @@  discard block
 block discarded – undo
5869 5869
 	 * @param int $posts_count Post counts.
5870 5870
 	 * @param string $post_type Post type.
5871 5871
 	 */
5872
-	$posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );	 
5872
+	$posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);	 
5873 5873
 	
5874 5874
 	return $posts_count;
5875 5875
 }
@@ -5887,8 +5887,8 @@  discard block
 block discarded – undo
5887 5887
  * @param string $post_type Post type.
5888 5888
  * @return int Posts count.
5889 5889
  */
5890
-function geodir_imex_count_events( $posts_count, $post_type ) {
5891
-	if ( $post_type == 'gd_event' ) {
5890
+function geodir_imex_count_events($posts_count, $post_type) {
5891
+	if ($post_type == 'gd_event') {
5892 5892
 		global $wpdb, $plugin_prefix;
5893 5893
 		
5894 5894
 		$table = $plugin_prefix . $post_type . '_detail';
@@ -5896,7 +5896,7 @@  discard block
 block discarded – undo
5896 5896
 
5897 5897
 		$query = "SELECT COUNT({$wpdb->posts}.ID) AS total FROM {$wpdb->posts} INNER JOIN {$table} ON ({$table}.post_id = {$wpdb->posts}.ID) INNER JOIN {$schedule_table} ON ({$schedule_table}.event_id = {$wpdb->posts}.ID) WHERE {$wpdb->posts}.post_type = %s";
5898 5898
 		
5899
-		$posts_count = (int)$wpdb->get_var( $wpdb->prepare( $query, $post_type ) );
5899
+		$posts_count = (int) $wpdb->get_var($wpdb->prepare($query, $post_type));
5900 5900
 	}
5901 5901
 	
5902 5902
 	return $posts_count;
@@ -5918,15 +5918,15 @@  discard block
 block discarded – undo
5918 5918
  * @param int $page_no Page number. Default 0.
5919 5919
  * @return array Array of posts data.
5920 5920
  */
5921
-function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {	
5921
+function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {	
5922 5922
 	global $wp_filesystem;
5923 5923
 
5924
-	$posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5924
+	$posts = geodir_get_export_posts($post_type, $per_page, $page_no);
5925 5925
 
5926 5926
 	$csv_rows = array();
5927 5927
 	
5928
-	if ( !empty( $posts ) ) {
5929
-		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5928
+	if (!empty($posts)) {
5929
+		$is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
5930 5930
 		
5931 5931
 		$csv_row = array();
5932 5932
 		$csv_row[] = 'post_id';
@@ -5937,7 +5937,7 @@  discard block
 block discarded – undo
5937 5937
 		$csv_row[] = 'default_category';
5938 5938
 		$csv_row[] = 'post_tags';
5939 5939
 		$csv_row[] = 'post_type';
5940
-		if ( $post_type == 'gd_event' ) {
5940
+		if ($post_type == 'gd_event') {
5941 5941
 			$csv_row[] = 'event_date';
5942 5942
 			$csv_row[] = 'event_enddate';
5943 5943
 			$csv_row[] = 'starttime';
@@ -5986,15 +5986,15 @@  discard block
 block discarded – undo
5986 5986
 		}
5987 5987
 		// WPML
5988 5988
 
5989
-		$custom_fields = geodir_imex_get_custom_fields( $post_type );
5990
-		if ( !empty( $custom_fields ) ) {
5991
-			foreach ( $custom_fields as $custom_field ) {
5989
+		$custom_fields = geodir_imex_get_custom_fields($post_type);
5990
+		if (!empty($custom_fields)) {
5991
+			foreach ($custom_fields as $custom_field) {
5992 5992
 				$csv_row[] = $custom_field->htmlvar_name;
5993 5993
 			}
5994 5994
 		}
5995 5995
 
5996 5996
 		// Export franchise fields
5997
-		$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5997
+		$is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
5998 5998
 		if ($is_franchise_active) {
5999 5999
 			$csv_row[] = 'gd_is_franchise';
6000 6000
 			$csv_row[] = 'gd_franchise_lock';
@@ -6004,12 +6004,12 @@  discard block
 block discarded – undo
6004 6004
 		$csv_rows[] = $csv_row;
6005 6005
 
6006 6006
 		$images_count = 5;
6007
-        $xx=0;
6008
-		foreach ( $posts as $post ) {$xx++;
6007
+        $xx = 0;
6008
+		foreach ($posts as $post) {$xx++;
6009 6009
 			$post_id = $post['ID'];
6010 6010
 			
6011
-			$gd_post_info = geodir_get_post_info( $post_id );
6012
-			$post_info = (array)$gd_post_info;
6011
+			$gd_post_info = geodir_get_post_info($post_id);
6012
+			$post_info = (array) $gd_post_info;
6013 6013
 						
6014 6014
 			$taxonomy_category = $post_type . 'category';
6015 6015
 			$taxonomy_tags = $post_type . '_tags';
@@ -6018,14 +6018,14 @@  discard block
 block discarded – undo
6018 6018
 			$default_category_id = $gd_post_info->default_category;
6019 6019
 			$default_category = '';
6020 6020
 			$post_tags = '';
6021
-			$terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
6021
+			$terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags));
6022 6022
 			
6023
-			if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
6023
+			if (!empty($terms) && !is_wp_error($terms)) {
6024 6024
 				$post_category = array();
6025 6025
 				$post_tags = array();
6026 6026
 			
6027
-				foreach ( $terms as $term ) {
6028
-					if ( $term->taxonomy == $taxonomy_category ) {
6027
+				foreach ($terms as $term) {
6028
+					if ($term->taxonomy == $taxonomy_category) {
6029 6029
 						$post_category[] = $term->name;
6030 6030
 						
6031 6031
 						if ($default_category_id == $term->term_id) {
@@ -6033,7 +6033,7 @@  discard block
 block discarded – undo
6033 6033
 						}
6034 6034
 					}
6035 6035
 					
6036
-					if ( $term->taxonomy == $taxonomy_tags ) {
6036
+					if ($term->taxonomy == $taxonomy_tags) {
6037 6037
 						$post_tags[] = $term->name;
6038 6038
 					}
6039 6039
 				}
@@ -6041,8 +6041,8 @@  discard block
 block discarded – undo
6041 6041
 				if (empty($default_category) && !empty($post_category)) {
6042 6042
 					$default_category = $post_category[0]; // Set first one as default category.
6043 6043
 				}
6044
-				$post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
6045
-				$post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
6044
+				$post_category = !empty($post_category) ? implode(',', $post_category) : '';
6045
+				$post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
6046 6046
 			}
6047 6047
 
6048 6048
 			// Franchise data
@@ -6050,42 +6050,42 @@  discard block
 block discarded – undo
6050 6050
 			$franchise_info = array();
6051 6051
 			$locked_fields = array();
6052 6052
 			
6053
-			if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
6053
+			if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
6054 6054
 				$franchise_id = $post_info['franchise'];
6055 6055
 				$gd_franchise_info = geodir_get_post_info($franchise_id);
6056 6056
 
6057 6057
 				if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
6058
-					$franchise_info = (array)$gd_franchise_info;
6058
+					$franchise_info = (array) $gd_franchise_info;
6059 6059
 					$locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
6060 6060
 					
6061 6061
 					if (!empty($locked_fields)) {
6062
-						foreach( $locked_fields as $locked_field) {
6062
+						foreach ($locked_fields as $locked_field) {
6063 6063
 							if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
6064 6064
 								$post_info[$locked_field] = $franchise_info[$locked_field];
6065 6065
 							}
6066 6066
 							
6067 6067
 							if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
6068
-								$franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
6068
+								$franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags));
6069 6069
 			
6070
-								if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
6070
+								if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
6071 6071
 									$franchise_post_category = array();
6072 6072
 									$franchise_post_tags = array();
6073 6073
 								
6074
-									foreach ( $franchise_terms as $franchise_term ) {
6075
-										if ( $franchise_term->taxonomy == $taxonomy_category ) {
6074
+									foreach ($franchise_terms as $franchise_term) {
6075
+										if ($franchise_term->taxonomy == $taxonomy_category) {
6076 6076
 											$franchise_post_category[] = $franchise_term->name;
6077 6077
 										}
6078 6078
 										
6079
-										if ( $franchise_term->taxonomy == $taxonomy_tags ) {
6079
+										if ($franchise_term->taxonomy == $taxonomy_tags) {
6080 6080
 											$franchise_post_tags[] = $franchise_term->name;
6081 6081
 										}
6082 6082
 									}
6083 6083
 									
6084 6084
 									if (in_array($taxonomy_category, $locked_fields)) {
6085
-										$post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
6085
+										$post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
6086 6086
 									}
6087 6087
 									if (in_array('post_tags', $locked_fields)) {
6088
-										$post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
6088
+										$post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
6089 6089
 									}
6090 6090
 								}
6091 6091
 							}
@@ -6094,18 +6094,18 @@  discard block
 block discarded – undo
6094 6094
 				}
6095 6095
 			}
6096 6096
 						
6097
-			$post_images = geodir_get_images( $post_id );
6097
+			$post_images = geodir_get_images($post_id);
6098 6098
 			$current_images = array();
6099
-			if ( !empty( $post_images ) ) {
6100
-				foreach ( $post_images as $post_image ) {
6101
-					$post_image = (array)$post_image;
6102
-					$image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
6103
-					if ( $image ) {
6099
+			if (!empty($post_images)) {
6100
+				foreach ($post_images as $post_image) {
6101
+					$post_image = (array) $post_image;
6102
+					$image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : '';
6103
+					if ($image) {
6104 6104
 						$current_images[] = $image;
6105 6105
 					}
6106 6106
 				}
6107 6107
 				
6108
-				$images_count = max( $images_count, count( $current_images ) );
6108
+				$images_count = max($images_count, count($current_images));
6109 6109
 			}
6110 6110
 
6111 6111
 			$csv_row = array();
@@ -6117,7 +6117,7 @@  discard block
 block discarded – undo
6117 6117
 			$csv_row[] = $default_category; // default_category
6118 6118
 			$csv_row[] = $post_tags; // post_tags
6119 6119
 			$csv_row[] = $post_type; // post_type
6120
-			if ( $post_type == 'gd_event' ) {
6120
+			if ($post_type == 'gd_event') {
6121 6121
 				$event_data = geodir_imex_get_event_data($post, $gd_post_info);
6122 6122
 				$csv_row[] = $event_data['event_date']; // event_date
6123 6123
 				$csv_row[] = $event_data['event_enddate']; // enddate
@@ -6138,9 +6138,9 @@  discard block
 block discarded – undo
6138 6138
 				$csv_row[] = $event_data['recurring_end_date']; // repeat_end
6139 6139
 			}
6140 6140
 			$csv_row[] = $post_info['post_status']; // post_status
6141
-			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
6141
+			$csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured
6142 6142
 			if ($is_payment_plugin) {
6143
-				$csv_row[] = (int)$post_info['package_id']; // package_id
6143
+				$csv_row[] = (int) $post_info['package_id']; // package_id
6144 6144
 				$csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
6145 6145
 			}
6146 6146
 			$csv_row[] = $post_info['geodir_video']; // geodir_video
@@ -6161,14 +6161,14 @@  discard block
 block discarded – undo
6161 6161
 			$csv_row[] = $post_info['geodir_special_offers']; // geodir_special_offers
6162 6162
 			// WPML
6163 6163
 			if ($is_wpml) {
6164
-				$csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
6165
-				$csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
6164
+				$csv_row[] = geodir_get_language_for_element($post_id, 'post_' . $post_type);
6165
+				$csv_row[] = geodir_imex_original_post_id($post_id, 'post_' . $post_type);
6166 6166
 			}
6167 6167
 			// WPML
6168 6168
 			
6169
-			if ( !empty( $custom_fields ) ) {
6170
-				foreach ( $custom_fields as $custom_field ) {
6171
-					$csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
6169
+			if (!empty($custom_fields)) {
6170
+				foreach ($custom_fields as $custom_field) {
6171
+					$csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : '';
6172 6172
 				}
6173 6173
 			}
6174 6174
 			
@@ -6179,26 +6179,26 @@  discard block
 block discarded – undo
6179 6179
 				$franchise = '';
6180 6180
 					
6181 6181
 				if (geodir_franchise_pkg_is_active($gd_post_info)) {
6182
-					$gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
6183
-					$locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
6182
+					$gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true);
6183
+					$locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : '';
6184 6184
 					$locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
6185
-					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
6185
+					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id
6186 6186
 				}
6187 6187
 				
6188
-				$csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
6188
+				$csv_row[] = (int) $gd_is_franchise; // gd_is_franchise
6189 6189
 				$csv_row[] = $locaked_fields; // gd_franchise_lock fields
6190
-				$csv_row[] = (int)$franchise; // franchise id
6190
+				$csv_row[] = (int) $franchise; // franchise id
6191 6191
 			}
6192 6192
 			
6193
-			for ( $c = 0; $c < $images_count; $c++ ) {
6194
-				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
6193
+			for ($c = 0; $c < $images_count; $c++) {
6194
+				$csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE
6195 6195
 			}
6196 6196
 			
6197 6197
 			$csv_rows[] = $csv_row;
6198 6198
 
6199 6199
 		}
6200 6200
 
6201
-		for ( $c = 0; $c < $images_count; $c++ ) {
6201
+		for ($c = 0; $c < $images_count; $c++) {
6202 6202
 			$csv_rows[0][] = 'IMAGE';
6203 6203
 		}
6204 6204
 	}
@@ -6220,19 +6220,19 @@  discard block
 block discarded – undo
6220 6220
  * @param int $page_no Page number. Default 0.
6221 6221
  * @return array Array of posts data.
6222 6222
  */
6223
-function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
6223
+function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
6224 6224
 	global $wpdb, $plugin_prefix;
6225 6225
 
6226
-	if ( ! post_type_exists( $post_type ) )
6226
+	if (!post_type_exists($post_type))
6227 6227
 		return new stdClass;
6228 6228
 		
6229 6229
 	$table = $plugin_prefix . $post_type . '_detail';
6230 6230
 	
6231 6231
 	$limit = '';
6232
-	if ( $per_page > 0 && $page_no > 0 ) {
6233
-		$offset = ( $page_no - 1 ) * $per_page;
6232
+	if ($per_page > 0 && $page_no > 0) {
6233
+		$offset = ($page_no - 1) * $per_page;
6234 6234
 		
6235
-		if ( $offset > 0 ) {
6235
+		if ($offset > 0) {
6236 6236
 			$limit = " LIMIT " . $offset . "," . $per_page;
6237 6237
 		} else {
6238 6238
 			$limit = " LIMIT " . $per_page;
@@ -6249,9 +6249,9 @@  discard block
 block discarded – undo
6249 6249
 	 * @param int $query The SQL query.
6250 6250
 	 * @param string $post_type Post type.
6251 6251
 	 */
6252
-	$query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
6252
+	$query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
6253 6253
 
6254
-	$results = (array)$wpdb->get_results( $wpdb->prepare( $query, $post_type ), ARRAY_A );
6254
+	$results = (array) $wpdb->get_results($wpdb->prepare($query, $post_type), ARRAY_A);
6255 6255
 
6256 6256
 	/**
6257 6257
 	 * Modify returned post results for the current post type.
@@ -6262,7 +6262,7 @@  discard block
 block discarded – undo
6262 6262
 	 * @param object $results An object containing all post ids.
6263 6263
 	 * @param string $post_type Post type.
6264 6264
 	 */
6265
-	return apply_filters( 'geodir_export_posts', $results, $post_type );
6265
+	return apply_filters('geodir_export_posts', $results, $post_type);
6266 6266
 }
6267 6267
 
6268 6268
 /**
@@ -6279,8 +6279,8 @@  discard block
 block discarded – undo
6279 6279
  * @param string $post_type Post type.
6280 6280
  * @return string The SQL query.
6281 6281
  */
6282
-function geodir_imex_get_events_query( $query, $post_type ) {
6283
-	if ( $post_type == 'gd_event' ) {
6282
+function geodir_imex_get_events_query($query, $post_type) {
6283
+	if ($post_type == 'gd_event') {
6284 6284
 		global $wpdb, $plugin_prefix;
6285 6285
 		
6286 6286
 		$table = $plugin_prefix . $post_type . '_detail';
@@ -6301,15 +6301,15 @@  discard block
 block discarded – undo
6301 6301
  * @param  string $post_type Post type.
6302 6302
  * @return int Total terms count.
6303 6303
  */
6304
-function geodir_get_terms_count( $post_type ) {
6305
-	$args = array( 'hide_empty' => 0 );
6304
+function geodir_get_terms_count($post_type) {
6305
+	$args = array('hide_empty' => 0);
6306 6306
 	
6307
-	remove_all_filters( 'get_terms' );
6307
+	remove_all_filters('get_terms');
6308 6308
 	
6309 6309
 	$taxonomy = $post_type . 'category';
6310 6310
 
6311
-	$count_terms = wp_count_terms( $taxonomy, $args );
6312
-	$count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
6311
+	$count_terms = wp_count_terms($taxonomy, $args);
6312
+	$count_terms = !is_wp_error($count_terms) ? $count_terms : 0;
6313 6313
 	 
6314 6314
 	return $count_terms;
6315 6315
 }
@@ -6326,23 +6326,23 @@  discard block
 block discarded – undo
6326 6326
  * @param int $page_no Page number. Default 0.
6327 6327
  * @return array Array of terms data.
6328 6328
  */
6329
-function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
6330
-	$args = array( 'hide_empty' => 0, 'orderby' => 'id' );
6329
+function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
6330
+	$args = array('hide_empty' => 0, 'orderby' => 'id');
6331 6331
 	
6332
-	remove_all_filters( 'get_terms' );
6332
+	remove_all_filters('get_terms');
6333 6333
 	
6334 6334
 	$taxonomy = $post_type . 'category';
6335 6335
 	
6336
-	if ( $per_page > 0 && $page_no > 0 ) {
6337
-		$args['offset'] = ( $page_no - 1 ) * $per_page;
6336
+	if ($per_page > 0 && $page_no > 0) {
6337
+		$args['offset'] = ($page_no - 1) * $per_page;
6338 6338
 		$args['number'] = $per_page;
6339 6339
 	}
6340 6340
 	
6341
-	$terms = get_terms( $taxonomy, $args );
6341
+	$terms = get_terms($taxonomy, $args);
6342 6342
 
6343 6343
 	$csv_rows = array();
6344 6344
 	
6345
-	if ( !empty( $terms ) ) {
6345
+	if (!empty($terms)) {
6346 6346
 		$csv_row = array();
6347 6347
 		$csv_row[] = 'cat_id';
6348 6348
 		$csv_row[] = 'cat_name';
@@ -6363,16 +6363,16 @@  discard block
 block discarded – undo
6363 6363
 		
6364 6364
 		$csv_rows[] = $csv_row;
6365 6365
 		
6366
-		foreach ( $terms as $term ) {			
6367
-			$cat_icon = get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
6368
-			$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
6366
+		foreach ($terms as $term) {			
6367
+			$cat_icon = get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type);
6368
+			$cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
6369 6369
 			
6370
-			$cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
6371
-			$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
6370
+			$cat_image = geodir_get_default_catimage($term->term_id, $post_type);
6371
+			$cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; 
6372 6372
 			
6373 6373
 			$cat_parent = '';
6374
-			if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
6375
-				$parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
6374
+			if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
6375
+				$parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
6376 6376
 				$cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
6377 6377
 			}
6378 6378
 			
@@ -6382,14 +6382,14 @@  discard block
 block discarded – undo
6382 6382
 			$csv_row[] = $term->slug;
6383 6383
 			$csv_row[] = $post_type;
6384 6384
 			$csv_row[] = $cat_parent;
6385
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
6385
+			$csv_row[] = get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type);
6386 6386
 			$csv_row[] = $term->description;
6387
-			$csv_row[] = get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
6387
+			$csv_row[] = get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type);
6388 6388
 			$csv_row[] = $cat_image;
6389 6389
 			$csv_row[] = $cat_icon;
6390 6390
 			// WPML
6391 6391
 			if ($is_wpml) {
6392
-				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
6392
+				$csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_' . $taxonomy);
6393 6393
 			}
6394 6394
 			// WPML
6395 6395
 			
@@ -6408,7 +6408,7 @@  discard block
 block discarded – undo
6408 6408
  * @param  bool $relative True for relative path & False for absolute path.
6409 6409
  * @return string Path to the cache directory.
6410 6410
  */
6411
-function geodir_path_import_export( $relative = true ) {
6411
+function geodir_path_import_export($relative = true) {
6412 6412
 	$upload_dir = wp_upload_dir();
6413 6413
 	
6414 6414
 	return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
@@ -6427,8 +6427,8 @@  discard block
 block discarded – undo
6427 6427
  * @param  bool $clear If true then it overwrite data otherwise add rows at the end of file.
6428 6428
  * @return bool true if success otherwise false.
6429 6429
  */
6430
-function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
6431
-	if ( empty( $csv_data ) ) {
6430
+function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
6431
+	if (empty($csv_data)) {
6432 6432
 		return false;
6433 6433
 	}
6434 6434
 	
@@ -6436,17 +6436,17 @@  discard block
 block discarded – undo
6436 6436
 	
6437 6437
 	$mode = $clear ? 'w+' : 'a+';
6438 6438
 	
6439
-	if ( function_exists( 'fputcsv' ) ) {
6440
-		$file = fopen( $file_path, $mode );
6441
-		foreach( $csv_data as $csv_row ) {
6439
+	if (function_exists('fputcsv')) {
6440
+		$file = fopen($file_path, $mode);
6441
+		foreach ($csv_data as $csv_row) {
6442 6442
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
6443
-			$write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
6443
+			$write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"');
6444 6444
 		}
6445
-		fclose( $file );
6445
+		fclose($file);
6446 6446
 	} else {
6447
-		foreach( $csv_data as $csv_row ) {
6447
+		foreach ($csv_data as $csv_row) {
6448 6448
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
6449
-			$wp_filesystem->put_contents( $file_path, $csv_row );
6449
+			$wp_filesystem->put_contents($file_path, $csv_row);
6450 6450
 		}
6451 6451
 	}
6452 6452
 		
@@ -6464,14 +6464,14 @@  discard block
 block discarded – undo
6464 6464
  * @param  string $file Full path to file.
6465 6465
  * @return int No of file rows.
6466 6466
  */
6467
-function geodir_import_export_line_count( $file ) {
6467
+function geodir_import_export_line_count($file) {
6468 6468
 	global $wp_filesystem;
6469 6469
 	
6470
-	if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
6471
-		$contents = $wp_filesystem->get_contents_array( $file );
6470
+	if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
6471
+		$contents = $wp_filesystem->get_contents_array($file);
6472 6472
 		
6473
-		if ( !empty( $contents ) && is_array( $contents ) ) {
6474
-			return count( $contents ) - 1;
6473
+		if (!empty($contents) && is_array($contents)) {
6474
+			return count($contents) - 1;
6475 6475
 		}
6476 6476
 	}
6477 6477
 	
@@ -6488,11 +6488,11 @@  discard block
 block discarded – undo
6488 6488
  * @param string $post_type The post type.
6489 6489
  * @return object Queried object.
6490 6490
  */
6491
-function geodir_imex_get_custom_fields( $post_type ) {
6491
+function geodir_imex_get_custom_fields($post_type) {
6492 6492
 	global $wpdb;
6493 6493
 	 
6494
-	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) );
6495
-	$rows = $wpdb->get_results( $sql );
6494
+	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array($post_type));
6495
+	$rows = $wpdb->get_results($sql);
6496 6496
 	 
6497 6497
 	return $rows;
6498 6498
 }
@@ -6574,9 +6574,9 @@  discard block
 block discarded – undo
6574 6574
 	$post_table = $plugin_prefix . $post_type . '_detail';
6575 6575
 	
6576 6576
 	$query = $wpdb->prepare("SELECT * FROM " . $post_table . " WHERE post_id = %d", array($master_post_id));
6577
-	$data = (array)$wpdb->get_row($query);
6577
+	$data = (array) $wpdb->get_row($query);
6578 6578
 	
6579
-	if ( !empty( $data ) ) {
6579
+	if (!empty($data)) {
6580 6580
 		$data['post_id'] = $tr_post_id;
6581 6581
 		unset($data['default_category'], $data['marker_json'], $data['featured_image'], $data[$post_type . 'category'], $data['overall_rating'], $data['rating_count'], $data['ratings']);
6582 6582
 		
@@ -6604,7 +6604,7 @@  discard block
 block discarded – undo
6604 6604
 	global $sitepress, $wpdb;
6605 6605
 	$post_type = get_post_type($master_post_id);
6606 6606
 	
6607
-	remove_filter('get_term', array($sitepress,'get_term_adjust_id')); // AVOID filtering to current language
6607
+	remove_filter('get_term', array($sitepress, 'get_term_adjust_id')); // AVOID filtering to current language
6608 6608
 
6609 6609
 	$taxonomies = get_object_taxonomies($post_type);
6610 6610
 	foreach ($taxonomies as $taxonomy) {
@@ -6613,9 +6613,9 @@  discard block
 block discarded – undo
6613 6613
 		
6614 6614
 		if ($terms) {
6615 6615
 			foreach ($terms as $term) {
6616
-				$tr_id = apply_filters( 'translate_object_id',$term->term_id, $taxonomy, false, $lang);
6616
+				$tr_id = apply_filters('translate_object_id', $term->term_id, $taxonomy, false, $lang);
6617 6617
 				
6618
-				if (!is_null($tr_id)){
6618
+				if (!is_null($tr_id)) {
6619 6619
 					// not using get_term - unfiltered get_term
6620 6620
 					$translated_term = $wpdb->get_row($wpdb->prepare("
6621 6621
 						SELECT * FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $taxonomy));
@@ -6624,8 +6624,8 @@  discard block
 block discarded – undo
6624 6624
 				}
6625 6625
 			}
6626 6626
 
6627
-			if (!is_taxonomy_hierarchical($taxonomy)){
6628
-				$terms_array = array_unique( array_map( 'intval', $terms_array ) );
6627
+			if (!is_taxonomy_hierarchical($taxonomy)) {
6628
+				$terms_array = array_unique(array_map('intval', $terms_array));
6629 6629
 			}
6630 6630
 
6631 6631
 			wp_set_post_terms($tr_post_id, $terms_array, $taxonomy);
@@ -6658,9 +6658,9 @@  discard block
 block discarded – undo
6658 6658
 	$query = $wpdb->prepare("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE mime_type like %s AND post_id = %d ORDER BY menu_order ASC", array('%image%', $master_post_id));
6659 6659
 	$post_images = $wpdb->get_results($query);
6660 6660
 	
6661
-	if ( !empty( $post_images ) ) {
6662
-		foreach ( $post_images as $post_image) {
6663
-			$image_data = (array)$post_image;
6661
+	if (!empty($post_images)) {
6662
+		foreach ($post_images as $post_image) {
6663
+			$image_data = (array) $post_image;
6664 6664
 			unset($image_data['ID']);
6665 6665
 			$image_data['post_id'] = $tr_post_id;
6666 6666
 			
@@ -6686,10 +6686,10 @@  discard block
 block discarded – undo
6686 6686
  * @return array Event data array.
6687 6687
  */
6688 6688
 function geodir_imex_get_event_data($post, $gd_post_info) {
6689
-	$event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : '';
6689
+	$event_date = isset($post['event_date']) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($post['event_date'])) : '';
6690 6690
 	$event_enddate = $event_date;
6691
-	$starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
6692
-	$endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
6691
+	$starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
6692
+	$endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
6693 6693
 	
6694 6694
 	$is_recurring_event = '';
6695 6695
 	$event_duration_days = '';
@@ -6707,15 +6707,15 @@  discard block
 block discarded – undo
6707 6707
 		
6708 6708
 	$recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
6709 6709
 	if (!empty($recurring_data)) {
6710
-		$event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date;
6711
-		$event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date;
6712
-		$starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
6713
-		$endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
6710
+		$event_date = isset($recurring_data['event_start']) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_start'])) : $event_date;
6711
+		$event_enddate = isset($recurring_data['event_end']) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_end'])) : $event_date;
6712
+		$starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
6713
+		$endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
6714 6714
 		$is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
6715 6715
 		$different_times = !empty($recurring_data['different_times']) ? true : false;
6716 6716
 	
6717
-		$recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
6718
-		$is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
6717
+		$recurring_pkg = geodir_event_recurring_pkg($gd_post_info);
6718
+		$is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true;
6719 6719
 			
6720 6720
 		if ($recurring_pkg && $is_recurring) {
6721 6721
 			$recurring_dates = $event_date;
@@ -6725,13 +6725,13 @@  discard block
 block discarded – undo
6725 6725
 			$recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
6726 6726
 			
6727 6727
 			if (!empty($recurring_data['event_recurring_dates'])) {
6728
-				$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
6728
+				$event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
6729 6729
 				
6730 6730
 				if (!empty($event_recurring_dates)) {
6731 6731
 					$recurring_dates = array();
6732 6732
 					
6733 6733
 					foreach ($event_recurring_dates as $date) {
6734
-						$recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
6734
+						$recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
6735 6735
 					}
6736 6736
 					
6737 6737
 					$recurring_dates = implode(",", $recurring_dates);
@@ -6747,7 +6747,7 @@  discard block
 block discarded – undo
6747 6747
 						$times = array();
6748 6748
 						
6749 6749
 						foreach ($recurring_data['starttimes'] as $time) {
6750
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6750
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
6751 6751
 						}
6752 6752
 						
6753 6753
 						$event_starttimes = implode(",", $times);
@@ -6757,7 +6757,7 @@  discard block
 block discarded – undo
6757 6757
 						$times = array();
6758 6758
 						
6759 6759
 						foreach ($recurring_data['endtimes'] as $time) {
6760
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
6760
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
6761 6761
 						}
6762 6762
 						
6763 6763
 						$event_endtimes = implode(",", $times);
@@ -6769,8 +6769,8 @@  discard block
 block discarded – undo
6769 6769
 					}
6770 6770
 				}
6771 6771
 			} else {
6772
-				$event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
6773
-				$recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6772
+				$event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1;
6773
+				$recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
6774 6774
 				
6775 6775
 				if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
6776 6776
 					$week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
@@ -6786,11 +6786,11 @@  discard block
 block discarded – undo
6786 6786
 				}
6787 6787
 				
6788 6788
 				$recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
6789
-				if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
6790
-					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : '';
6789
+				if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
6790
+					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['repeat_end'])) : '';
6791 6791
 					$max_recurring_count = empty($recurring_end_date) ? 1 : '';
6792 6792
 				} else {
6793
-					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
6793
+					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1);
6794 6794
 				}
6795 6795
 			}
6796 6796
 		}
@@ -6854,9 +6854,9 @@  discard block
 block discarded – undo
6854 6854
  * @return array Event data array.
6855 6855
  */
6856 6856
 function geodir_imex_process_event_data($gd_post) {
6857
-	$recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
6857
+	$recurring_pkg = geodir_event_recurring_pkg((object) $gd_post);
6858 6858
 
6859
-	$is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
6859
+	$is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true;
6860 6860
 	$event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_imex_get_date_ymd($gd_post['event_date']) : '';
6861 6861
 	$event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_imex_get_date_ymd($gd_post['event_enddate']) : $event_date;
6862 6862
 	$all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
@@ -6903,17 +6903,17 @@  discard block
 block discarded – undo
6903 6903
 				$event_recurring_dates = implode(",", $event_recurring_dates);
6904 6904
 			}
6905 6905
 		} else {
6906
-			$duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6907
-			$repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6908
-			$max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6909
-			$repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6906
+			$duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1;
6907
+			$repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1;
6908
+			$max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1;
6909
+			$repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_imex_get_date_ymd($gd_post['recurring_end_date']) : '';
6910 6910
 			
6911 6911
 			$repeat_end_type = $repeat_end != '' ? 1 : 0;
6912 6912
 			$max_repeat = $repeat_end != '' ? '' : $max_repeat;
6913 6913
 			
6914 6914
 			$week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6915 6915
 			
6916
-			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6916
+			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6917 6917
 			$repeat_days = array();
6918 6918
 			if (!empty($a_repeat_days)) {
6919 6919
 				foreach ($a_repeat_days as $repeat_day) {
@@ -6931,7 +6931,7 @@  discard block
 block discarded – undo
6931 6931
 			$repeat_weeks = array();
6932 6932
 			if (!empty($a_repeat_weeks)) {
6933 6933
 				foreach ($a_repeat_weeks as $repeat_week) {
6934
-					$repeat_weeks[] = (int)$repeat_week;
6934
+					$repeat_weeks[] = (int) $repeat_week;
6935 6935
 				}
6936 6936
 				
6937 6937
 				$repeat_weeks = array_unique($repeat_weeks);
@@ -7052,7 +7052,7 @@  discard block
 block discarded – undo
7052 7052
  */
7053 7053
 function geodir_admin_upgrade_notice() {
7054 7054
     $class = "error";
7055
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
7055
+    $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
7056 7056
     echo"<div class=\"$class\"> <p>$message</p></div>";
7057 7057
 }
7058 7058
 
@@ -7067,7 +7067,7 @@  discard block
 block discarded – undo
7067 7067
  * @param (object) $r
7068 7068
  * @return (string) $output
7069 7069
  */
7070
-function geodire_admin_upgrade_notice( $plugin_data, $r )
7070
+function geodire_admin_upgrade_notice($plugin_data, $r)
7071 7071
 {
7072 7072
     // readme contents
7073 7073
     $args = array(
@@ -7075,7 +7075,7 @@  discard block
 block discarded – undo
7075 7075
         'redirection' => 5
7076 7076
     );
7077 7077
     $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
7078
-    $data       = wp_remote_get( $url, $args );
7078
+    $data = wp_remote_get($url, $args);
7079 7079
 
7080 7080
     if (!is_wp_error($data) && $data['response']['code'] == 200) {
7081 7081
 
@@ -7090,20 +7090,20 @@  discard block
 block discarded – undo
7090 7090
 function geodir_in_plugin_update_message($content) {
7091 7091
     // Output Upgrade Notice
7092 7092
     $matches        = null;
7093
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
7093
+    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote(GEODIRECTORY_VERSION) . '\s*=|$)~Uis';
7094 7094
     $upgrade_notice = '';
7095
-    if ( preg_match( $regexp, $content, $matches ) ) {
7096
-        if(empty($matches)){return;}
7095
+    if (preg_match($regexp, $content, $matches)) {
7096
+        if (empty($matches)) {return; }
7097 7097
         //print_r($matches );
7098
-        $version = trim( $matches[1] );
7099
-        if($version && $version>GEODIRECTORY_VERSION){
7098
+        $version = trim($matches[1]);
7099
+        if ($version && $version > GEODIRECTORY_VERSION) {
7100 7100
 
7101 7101
 
7102
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
7103
-        if ( version_compare( WC_VERSION, $version, '<' ) ) {
7102
+        $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
7103
+        if (version_compare(WC_VERSION, $version, '<')) {
7104 7104
             $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
7105
-            foreach ( $notices as $index => $line ) {
7106
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
7105
+            foreach ($notices as $index => $line) {
7106
+                $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
7107 7107
             }
7108 7108
             $upgrade_notice .= '</div> ';
7109 7109
         }
@@ -7127,7 +7127,7 @@  discard block
 block discarded – undo
7127 7127
 		$default_language = $sitepress->get_default_language();
7128 7128
 		if ($current_language != 'all' && $current_language != $default_language) {
7129 7129
 	?>
7130
-	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory');?></strong></p></div>
7130
+	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory'); ?></strong></p></div>
7131 7131
 	<?php
7132 7132
 		}
7133 7133
 	}
Please login to merge, or discard this patch.
geodirectory-admin/admin_hooks_actions.php 3 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * GeoDirectory Admin.
4
- *
5
- * Main admin file which loads all settings panels and sets up admin menus.
6
- *
7
- * @since 1.0.0
8
- * @package GeoDirectory
9
- */
3
+     * GeoDirectory Admin.
4
+     *
5
+     * Main admin file which loads all settings panels and sets up admin menus.
6
+     *
7
+     * @since 1.0.0
8
+     * @package GeoDirectory
9
+     */
10 10
 
11 11
 add_action('admin_init', 'geodir_admin_init');
12 12
 if (!function_exists('geodir_admin_init')) {
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
 {
86 86
     global $pagenow;
87 87
 	
88
-	// Get the current post type
89
-	$post_type = geodir_admin_current_post_type();
90
-	$geodir_post_types = geodir_get_posttypes();
88
+    // Get the current post type
89
+    $post_type = geodir_admin_current_post_type();
90
+    $geodir_post_types = geodir_get_posttypes();
91 91
     
92
-	if ((isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') || (($pagenow == 'post.php' || $pagenow == 'post-new.php' || $pagenow == 'edit.php') && $post_type && in_array($post_type, $geodir_post_types)) || ($pagenow == 'edit-tags.php' || $pagenow == 'edit-comments.php' || $pagenow == 'comment.php')) {
92
+    if ((isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') || (($pagenow == 'post.php' || $pagenow == 'post-new.php' || $pagenow == 'edit.php') && $post_type && in_array($post_type, $geodir_post_types)) || ($pagenow == 'edit-tags.php' || $pagenow == 'edit-comments.php' || $pagenow == 'comment.php')) {
93 93
         add_action('admin_enqueue_scripts', 'geodir_admin_scripts');
94 94
         add_action('admin_enqueue_scripts', 'geodir_admin_styles');
95 95
     }
@@ -1517,20 +1517,20 @@  discard block
 block discarded – undo
1517 1517
 function geodir_diagnose_load_db_language() {
1518 1518
     global $wpdb;
1519 1519
 	
1520
-	$is_error_during_diagnose = geodirectory_load_db_language();
1520
+    $is_error_during_diagnose = geodirectory_load_db_language();
1521 1521
 
1522 1522
     $output_str = '';
1523 1523
 
1524 1524
     if ($is_error_during_diagnose) {
1525 1525
         $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>";
1526
-		$info_div_class = "geodir_problem_info";
1526
+        $info_div_class = "geodir_problem_info";
1527 1527
     } else {
1528 1528
         $output_str .= "<li>" . __('Load custom fields in to file for translation: ok', 'geodirectory') . "</li>";
1529
-		$info_div_class = "geodir_noproblem_info";
1529
+        $info_div_class = "geodir_noproblem_info";
1530 1530
         $fix_button_txt = '';
1531 1531
     }
1532 1532
     
1533
-	echo "<ul class='$info_div_class'>";
1533
+    echo "<ul class='$info_div_class'>";
1534 1534
     echo $output_str;
1535 1535
     echo $fix_button_txt;
1536 1536
     echo "</ul>";
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
     $uploads = wp_upload_dir();
1656 1656
     ini_set('auto_detect_line_endings', true);
1657 1657
 	
1658
-	$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
1658
+    $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
1659 1659
 
1660 1660
     $task = isset($_POST['task']) ? $_POST['task'] : '';
1661 1661
     $uploadedFile = isset($_POST['gddata']['uploadedFile']) ? $_POST['gddata']['uploadedFile'] : NULL;
@@ -1855,8 +1855,8 @@  discard block
 block discarded – undo
1855 1855
                             $post_longitude = addslashes($buffer[$c]);
1856 1856
                         }
1857 1857
 						
1858
-						// Post status
1859
-						if ($customKeyarray[$c] == 'post_status') {
1858
+                        // Post status
1859
+                        if ($customKeyarray[$c] == 'post_status') {
1860 1860
                             $post_status = sanitize_key( $buffer[$c] );
1861 1861
                         }
1862 1862
                     }
@@ -1873,10 +1873,10 @@  discard block
 block discarded – undo
1873 1873
                         }
1874 1874
                     }
1875 1875
 					
1876
-					// Default post status
1877
-					$default_status = 'publish';
1878
-					$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
1879
-					$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
1876
+                    // Default post status
1877
+                    $default_status = 'publish';
1878
+                    $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
1879
+                    $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
1880 1880
 
1881 1881
                     $my_post['post_title'] = $post_title;
1882 1882
                     $my_post['post_content'] = $post_desc;
@@ -2099,5 +2099,5 @@  discard block
 block discarded – undo
2099 2099
 add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2100 2100
 
2101 2101
 if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
2102
-	add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice');
2102
+    add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice');
2103 2103
 }
2104 2104
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 }
238 238
 
239
-add_action('save_post', 'geodir_post_information_save',10,2);
239
+add_action('save_post', 'geodir_post_information_save', 10, 2);
240 240
 
241 241
 
242 242
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
             $gd_taxonomy = geodir_get_taxonomies($geodir_post_type);
265 265
 
266
-            if(!empty($gd_taxonomy)) {
266
+            if (!empty($gd_taxonomy)) {
267 267
                 foreach ($gd_taxonomy as $tax) {
268 268
 
269 269
                     remove_meta_box($tax . 'div', $geodir_post_type, 'normal');
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
     global $wpdb;
416 416
     $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
417 417
     ?>
418
-    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
418
+    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/>
419 419
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
420 420
     <ul>
421 421
     <?php
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
             
434 434
             $display = $check_html_variable ? ' style="display:none;"' : '';
435 435
             ?>
436
-            <li <?php echo $display;?>>
437
-            <a id="gt-<?php echo $val['field_type'];?>-_-<?php echo $val['htmlvar_name'];?>"
438
-               title="<?php echo $val['site_title'];?>"
439
-               class="gt-draggable-form-items gt-<?php echo $val['field_type'];?> geodir-sort-<?php echo $val['htmlvar_name'];?>"
440
-               href="javascript:void(0);"><b></b><?php _e($val['site_title'], 'geodirectory');?></a>
436
+            <li <?php echo $display; ?>>
437
+            <a id="gt-<?php echo $val['field_type']; ?>-_-<?php echo $val['htmlvar_name']; ?>"
438
+               title="<?php echo $val['site_title']; ?>"
439
+               class="gt-draggable-form-items gt-<?php echo $val['field_type']; ?> geodir-sort-<?php echo $val['htmlvar_name']; ?>"
440
+               href="javascript:void(0);"><b></b><?php _e($val['site_title'], 'geodirectory'); ?></a>
441 441
             </li>
442 442
             <?php
443 443
         }
@@ -491,39 +491,39 @@  discard block
 block discarded – undo
491 491
 {
492 492
     $listing_type = ($_REQUEST['listing_type'] != '') ? sanitize_text_field($_REQUEST['listing_type']) : 'gd_place';
493 493
     ?>
494
-    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type;?>"/>
494
+    <input type="hidden" name="listing_type" id="new_post_type" value="<?php echo $listing_type; ?>"/>
495 495
     <input type="hidden" name="manage_field_type" class="manage_field_type" value="<?php echo sanitize_text_field($_REQUEST['subtab']); ?>"/>
496 496
     <ul class="full">
497
-        <li><a id="gt-fieldset" class="gt-draggable-form-items gt-fieldset" href="javascript:void(0);"><?php _e('Fieldset', 'geodirectory');?></a></li>
497
+        <li><a id="gt-fieldset" class="gt-draggable-form-items gt-fieldset" href="javascript:void(0);"><?php _e('Fieldset', 'geodirectory'); ?></a></li>
498 498
     </ul>
499 499
     <ul>
500 500
         <li><a id="gt-text" class="gt-draggable-form-items gt-text"
501
-               href="javascript:void(0);"><b></b><?php _e('Text', 'geodirectory');?></a></li>
501
+               href="javascript:void(0);"><b></b><?php _e('Text', 'geodirectory'); ?></a></li>
502 502
         <li><a id="gt-datepicker" class="gt-draggable-form-items gt-datepicker"
503
-               href="javascript:void(0);"><b></b><?php _e('Date', 'geodirectory');?></a></li>
503
+               href="javascript:void(0);"><b></b><?php _e('Date', 'geodirectory'); ?></a></li>
504 504
         <li><a id="gt-textarea" class="gt-draggable-form-items gt-textarea"
505
-               href="javascript:void(0);"><b></b><?php _e('Textarea', 'geodirectory');?></a></li>
505
+               href="javascript:void(0);"><b></b><?php _e('Textarea', 'geodirectory'); ?></a></li>
506 506
         <li><a id="gt-time" class="gt-draggable-form-items gt-time"
507
-               href="javascript:void(0);"><b></b><?php _e('Time', 'geodirectory');?></a></li>
507
+               href="javascript:void(0);"><b></b><?php _e('Time', 'geodirectory'); ?></a></li>
508 508
         <li><a id="gt-checkbox" class="gt-draggable-form-items gt-checkbox"
509
-               href="javascript:void(0);"><b></b><?php _e('Checkbox', 'geodirectory');?></a></li>
509
+               href="javascript:void(0);"><b></b><?php _e('Checkbox', 'geodirectory'); ?></a></li>
510 510
         <li><a id="gt-phone" class="gt-draggable-form-items gt-phone"
511
-               href="javascript:void(0);"><b></b><?php _e('Phone', 'geodirectory');?></a></li>
511
+               href="javascript:void(0);"><b></b><?php _e('Phone', 'geodirectory'); ?></a></li>
512 512
         <li><a id="gt-radio" class="gt-draggable-form-items gt-radio"
513
-               href="javascript:void(0);"><b></b><?php _e('Radio', 'geodirectory');?></a></li>
513
+               href="javascript:void(0);"><b></b><?php _e('Radio', 'geodirectory'); ?></a></li>
514 514
         <li><a id="gt-email" class="gt-draggable-form-items gt-email"
515
-               href="javascript:void(0);"><b></b><?php _e('Email', 'geodirectory');?></a></li>
515
+               href="javascript:void(0);"><b></b><?php _e('Email', 'geodirectory'); ?></a></li>
516 516
         <li><a id="gt-select" class="gt-draggable-form-items gt-select"
517
-               href="javascript:void(0);"><b></b><?php _e('Select', 'geodirectory');?></a></li>
518
-        <!--<li><a id="gt-taxonomy" class="gt-draggable-form-items gt-select" href="javascript:void(0);"><b></b><?php _e('Taxonomy', 'geodirectory');?></a></li>-->
517
+               href="javascript:void(0);"><b></b><?php _e('Select', 'geodirectory'); ?></a></li>
518
+        <!--<li><a id="gt-taxonomy" class="gt-draggable-form-items gt-select" href="javascript:void(0);"><b></b><?php _e('Taxonomy', 'geodirectory'); ?></a></li>-->
519 519
         <li><a id="gt-multiselect" class="gt-draggable-form-items gt-multiselect"
520
-               href="javascript:void(0);"><b></b><?php _e('Multi Select', 'geodirectory');?></a></li>
520
+               href="javascript:void(0);"><b></b><?php _e('Multi Select', 'geodirectory'); ?></a></li>
521 521
         <li><a id="gt-url" class="gt-draggable-form-items gt-url"
522
-               href="javascript:void(0);"><b></b><?php _e('URL', 'geodirectory');?></a></li>
522
+               href="javascript:void(0);"><b></b><?php _e('URL', 'geodirectory'); ?></a></li>
523 523
         <li><a id="gt-html" class="gt-draggable-form-items gt-html"
524
-               href="javascript:void(0);"><b></b><?php _e('HTML', 'geodirectory');?></a></li>
524
+               href="javascript:void(0);"><b></b><?php _e('HTML', 'geodirectory'); ?></a></li>
525 525
         <li><a id="gt-file" class="gt-draggable-form-items gt-file"
526
-               href="javascript:void(0);"><b></b><?php _e('File Upload', 'geodirectory');?></a></li>
526
+               href="javascript:void(0);"><b></b><?php _e('File Upload', 'geodirectory'); ?></a></li>
527 527
 
528 528
     </ul>
529 529
 
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 
635 635
     switch ($sub_tab) {
636 636
         case 'custom_fields':
637
-            $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type));;
637
+            $note = sprintf(__('Click on any box below to add a field of that type on add %s listing form. You must be use a fieldset to group your fields.', 'geodirectory'), get_post_type_singular_label($listing_type)); ;
638 638
             break;
639 639
 
640 640
         case 'sorting_options':
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 
689 689
     switch ($sub_tab) {
690 690
         case 'custom_fields':
691
-            $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type));;
691
+            $note = sprintf(__('Click to expand and view field related settings. You may drag and drop to arrange fields order on add %s listing form too.', 'geodirectory'), get_post_type_singular_label($listing_type)); ;
692 692
             break;
693 693
 
694 694
         case 'sorting_options':
@@ -787,13 +787,13 @@  discard block
 block discarded – undo
787 787
         $filter_arr['is_error_during_diagnose'] = true;
788 788
 
789 789
         if ($fix) {
790
-            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak");// get backup table count
791
-            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table");// get new table count
790
+            $ms_bak_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $table . "_ms_bak"); // get backup table count
791
+            $new_table_count = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "$table"); // get new table count
792 792
 
793 793
             if ($ms_bak_count == $new_table_count) {// if they are the same count rename to bak2
794 794
                 //$filter_arr['output_str'] .= "<li>".sprintf( __('-->PROBLEM: %s table count is the same as new table, contact support' , 'geodirectory'), $table )."</li>" ;
795 795
 
796
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename bak table to new table
796
+                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2"); // rename bak table to new table
797 797
 
798 798
                 if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
799 799
                     $filter_arr['output_str'] .= "<li>" . __('-->FIXED: Renamed and backed up the tables', 'geodirectory') . "</li>";
@@ -803,8 +803,8 @@  discard block
 block discarded – undo
803 803
 
804 804
             } elseif ($ms_bak_count > $new_table_count) {//if backup is greater then restore it
805 805
 
806
-                $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2");// rename new table to bak2
807
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table");// rename bak table to new table
806
+                $wpdb->query("RENAME TABLE " . $wpdb->prefix . "$table TO " . $table . "_ms_bak2"); // rename new table to bak2
807
+                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $wpdb->prefix . "$table"); // rename bak table to new table
808 808
 
809 809
                 if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak2'") && $wpdb->query("SHOW TABLES LIKE '" . $wpdb->prefix . "$table'") && $wpdb->query("SHOW TABLES LIKE '$table'") == 0) {
810 810
                     $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: restored largest table %s', 'geodirectory'), $table) . "</li>";
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 
815 815
             } elseif ($new_table_count > $ms_bak_count) {// we cant do much so rename the table to stop errors
816 816
 
817
-                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2");// rename ms_bak table to ms_bak2
817
+                $wpdb->query("RENAME TABLE " . $table . "_ms_bak TO " . $table . "_ms_bak2"); // rename ms_bak table to ms_bak2
818 818
 
819 819
                 if ($wpdb->query("SHOW TABLES LIKE '" . $table . "_ms_bak'") == 0) {
820 820
                     $filter_arr['output_str'] .= "<li>" . sprintf(__('-->FIXED: table %s_ms_bak renamed and backed up', 'geodirectory'), $table) . "</li>";
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
                             $post_categories[$p->post_type . 'category'] = str_replace("d:", "", $post_categories[$p->post_type . 'category']);
999 999
                             foreach (explode(",", $post_categories[$p->post_type . 'category']) as $cat_part) {
1000 1000
                                 if (is_numeric($cat_part)) {
1001
-                                    $raw_cats[] = (int)$cat_part;
1001
+                                    $raw_cats[] = (int) $cat_part;
1002 1002
                                 }
1003 1003
                             }
1004 1004
 
@@ -1308,9 +1308,9 @@  discard block
 block discarded – undo
1308 1308
     //////////////////////////////////
1309 1309
     $option_value = get_option('geodir_home_page');
1310 1310
     $page = get_post($option_value);
1311
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1311
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1312 1312
 
1313
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1313
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1314 1314
         $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1315 1315
     else {
1316 1316
         $is_error_during_diagnose = true;
@@ -1333,9 +1333,9 @@  discard block
 block discarded – undo
1333 1333
     //////////////////////////////////
1334 1334
     $option_value = get_option('geodir_add_listing_page');
1335 1335
     $page = get_post($option_value);
1336
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1336
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1337 1337
 
1338
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1338
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1339 1339
         $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1340 1340
     else {
1341 1341
         $is_error_during_diagnose = true;
@@ -1359,9 +1359,9 @@  discard block
 block discarded – undo
1359 1359
     //////////////////////////////////
1360 1360
     $option_value = get_option('geodir_preview_page');
1361 1361
     $page = get_post($option_value);
1362
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1362
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1363 1363
 
1364
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1364
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1365 1365
         $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1366 1366
     else {
1367 1367
         $is_error_during_diagnose = true;
@@ -1384,9 +1384,9 @@  discard block
 block discarded – undo
1384 1384
     //////////////////////////////////
1385 1385
     $option_value = get_option('geodir_success_page');
1386 1386
     $page = get_post($option_value);
1387
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1387
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1388 1388
 
1389
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1389
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1390 1390
         $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1391 1391
     else {
1392 1392
         $is_error_during_diagnose = true;
@@ -1409,9 +1409,9 @@  discard block
 block discarded – undo
1409 1409
     //////////////////////////////////
1410 1410
     $option_value = get_option('geodir_info_page');
1411 1411
     $page = get_post($option_value);
1412
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1412
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1413 1413
 
1414
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1414
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1415 1415
         $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1416 1416
     else {
1417 1417
         $is_error_during_diagnose = true;
@@ -1434,9 +1434,9 @@  discard block
 block discarded – undo
1434 1434
     //////////////////////////////////
1435 1435
     $option_value = get_option('geodir_login_page');
1436 1436
     $page = get_post($option_value);
1437
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1437
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1438 1438
 
1439
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1439
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1440 1440
         $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1441 1441
     else {
1442 1442
         $is_error_during_diagnose = true;
@@ -1459,9 +1459,9 @@  discard block
 block discarded – undo
1459 1459
     //////////////////////////////////
1460 1460
     $option_value = get_option('geodir_location_page');
1461 1461
     $page = get_post($option_value);
1462
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1462
+    if (!empty($page)) {$page_found = $page->ID; } else {$page_found = ''; }
1463 1463
 
1464
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1464
+    if (!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status == 'publish')
1465 1465
         $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1466 1466
     else {
1467 1467
         $is_error_during_diagnose = true;
@@ -1479,13 +1479,13 @@  discard block
 block discarded – undo
1479 1479
     /* Diagnose Location Page Ends */
1480 1480
     ////////////////////////////////
1481 1481
 
1482
-    $page_chk_arr = array('output_str'=>$output_str,'is_error_during_diagnose'=>$is_error_during_diagnose );
1482
+    $page_chk_arr = array('output_str'=>$output_str, 'is_error_during_diagnose'=>$is_error_during_diagnose);
1483 1483
     /**
1484 1484
      * This action is called at the end of the GD Tools page check function.
1485 1485
      *
1486 1486
      * @since 1.5.2
1487 1487
      */
1488
-    $page_chk_arr = apply_filters('geodir_diagnose_default_pages',$page_chk_arr);
1488
+    $page_chk_arr = apply_filters('geodir_diagnose_default_pages', $page_chk_arr);
1489 1489
 
1490 1490
     $output_str = $page_chk_arr['output_str'];
1491 1491
     $is_error_during_diagnose = $page_chk_arr['is_error_during_diagnose'];
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
 
1683 1683
                 if (($handle = fopen($target_path, "r")) !== FALSE) {
1684 1684
                     while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
1685
-                        if(is_array($data) && !empty($data)) {
1685
+                        if (is_array($data) && !empty($data)) {
1686 1686
                             $file[] = '"' . implode('","', $data) . '"';
1687 1687
                         }
1688 1688
                     }
@@ -1857,7 +1857,7 @@  discard block
 block discarded – undo
1857 1857
 						
1858 1858
 						// Post status
1859 1859
 						if ($customKeyarray[$c] == 'post_status') {
1860
-                            $post_status = sanitize_key( $buffer[$c] );
1860
+                            $post_status = sanitize_key($buffer[$c]);
1861 1861
                         }
1862 1862
                     }
1863 1863
 
@@ -1875,8 +1875,8 @@  discard block
 block discarded – undo
1875 1875
 					
1876 1876
 					// Default post status
1877 1877
 					$default_status = 'publish';
1878
-					$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
1879
-					$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
1878
+					$post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
1879
+					$post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
1880 1880
 
1881 1881
                     $my_post['post_title'] = $post_title;
1882 1882
                     $my_post['post_content'] = $post_desc;
@@ -1920,7 +1920,7 @@  discard block
 block discarded – undo
1920 1920
                     $payment_info = array();
1921 1921
                     $package_info = array();
1922 1922
 
1923
-                    $package_info = (array)geodir_post_package_info($package_info, '', $buffer[5]);
1923
+                    $package_info = (array) geodir_post_package_info($package_info, '', $buffer[5]);
1924 1924
                     $package_id = '';
1925 1925
                     if (isset($gd_post_info['package_id']) && $gd_post_info['package_id'] != '') {
1926 1926
                         $package_id = $gd_post_info['package_id'];
@@ -2021,11 +2021,11 @@  discard block
 block discarded – undo
2021 2021
 }
2022 2022
 
2023 2023
 // Add the tab in left sidebar menu fro import & export page.
2024
-add_filter( 'geodir_settings_tabs_array', 'geodir_import_export_tab', 94 );
2024
+add_filter('geodir_settings_tabs_array', 'geodir_import_export_tab', 94);
2025 2025
 
2026 2026
 // Handle ajax request for impot/export.
2027
-add_action( 'wp_ajax_geodir_import_export', 'geodir_ajax_import_export' );
2028
-add_action( 'wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export' );
2027
+add_action('wp_ajax_geodir_import_export', 'geodir_ajax_import_export');
2028
+add_action('wp_ajax_nopriv_geodir_import_exportn', 'geodir_ajax_import_export');
2029 2029
 
2030 2030
 
2031 2031
 /**
@@ -2036,40 +2036,40 @@  discard block
 block discarded – undo
2036 2036
  * @param $post_id int $post_id The post ID of the post being saved.
2037 2037
  * @param $post object $post The post object of the post being saved.
2038 2038
  */
2039
-function geodir_update_location_prefix($post_id,$post){
2040
-    if($post->post_type=='page' && $post->post_name && $post_id==get_option('geodir_location_page')){
2041
-        update_option('geodir_location_prefix',$post->post_name);
2039
+function geodir_update_location_prefix($post_id, $post) {
2040
+    if ($post->post_type == 'page' && $post->post_name && $post_id == get_option('geodir_location_page')) {
2041
+        update_option('geodir_location_prefix', $post->post_name);
2042 2042
     }
2043 2043
 
2044 2044
 }
2045 2045
 
2046
-add_action('save_post', 'geodir_update_location_prefix',10,2);
2046
+add_action('save_post', 'geodir_update_location_prefix', 10, 2);
2047 2047
 
2048
-add_action( 'wp_ajax_geodir_ga_callback', 'geodir_ga_callback' );
2048
+add_action('wp_ajax_geodir_ga_callback', 'geodir_ga_callback');
2049 2049
 
2050
-function geodir_ga_callback(){
2050
+function geodir_ga_callback() {
2051 2051
 
2052
-if(isset($_REQUEST['code']) && $_REQUEST['code']) {
2052
+if (isset($_REQUEST['code']) && $_REQUEST['code']) {
2053 2053
     $oAuthURL = "https://www.googleapis.com/oauth2/v3/token?";
2054
-    $code = "code=".$_REQUEST['code'];
2054
+    $code = "code=" . $_REQUEST['code'];
2055 2055
     $grant_type = "&grant_type=authorization_code";
2056 2056
     $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
2057
-    $client_id = "&client_id=".get_option('geodir_ga_client_id');
2058
-    $client_secret = "&client_secret=".get_option('geodir_ga_client_secret');
2057
+    $client_id = "&client_id=" . get_option('geodir_ga_client_id');
2058
+    $client_secret = "&client_secret=" . get_option('geodir_ga_client_secret');
2059 2059
 
2060
-    $auth_url = $oAuthURL . $code . $redirect_uri .  $grant_type . $client_id .$client_secret;
2060
+    $auth_url = $oAuthURL . $code . $redirect_uri . $grant_type . $client_id . $client_secret;
2061 2061
 
2062 2062
     $response = wp_remote_post($auth_url, array('timeout' => 15));
2063 2063
 
2064 2064
     //print_r($response);
2065 2065
 
2066
-    $error_msg =  __('Something went wrong','geodirectory');
2067
-    if(!empty($response['response']['code']) && $response['response']['code']==200){
2066
+    $error_msg = __('Something went wrong', 'geodirectory');
2067
+    if (!empty($response['response']['code']) && $response['response']['code'] == 200) {
2068 2068
 
2069 2069
         $parts = json_decode($response['body']);
2070 2070
         //print_r($parts);
2071
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2072
-        else{
2071
+        if (!isset($parts->access_token)) {echo $error_msg . " - #1"; exit; }
2072
+        else {
2073 2073
 
2074 2074
             update_option('gd_ga_access_token', $parts->access_token);
2075 2075
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2078,25 +2078,25 @@  discard block
 block discarded – undo
2078 2078
 
2079 2079
 
2080 2080
     }
2081
-    elseif(!empty($response['response']['code'])) {
2081
+    elseif (!empty($response['response']['code'])) {
2082 2082
         $parts = json_decode($response['body']);
2083 2083
 
2084
-        if(isset($parts->error)){
2085
-            echo $parts->error.": ".$parts->error_description;exit;
2086
-        }else{
2087
-            echo $error_msg." - #2";exit;
2084
+        if (isset($parts->error)) {
2085
+            echo $parts->error . ": " . $parts->error_description; exit;
2086
+        } else {
2087
+            echo $error_msg . " - #2"; exit;
2088 2088
         }
2089 2089
 
2090
-    }else{
2090
+    } else {
2091 2091
 
2092
-        echo $error_msg." - #3";exit;
2092
+        echo $error_msg . " - #3"; exit;
2093 2093
 
2094 2094
     }
2095 2095
 }
2096 2096
     exit;
2097 2097
 }
2098 2098
 
2099
-add_filter( 'icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4 );
2099
+add_filter('icl_make_duplicate', 'geodir_icl_make_duplicate', 11, 4);
2100 2100
 
2101 2101
 if (isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
2102 2102
 	add_action('geodir_before_admin_panel', 'geodir_wpml_permalink_setting_notice');
Please login to merge, or discard this patch.
Braces   +58 added lines, -50 removed lines patch added patch discarded remove patch
@@ -24,8 +24,11 @@  discard block
 block discarded – undo
24 24
             global $current_tab;
25 25
             geodir_redirect_to_admin_panel_on_installed();
26 26
             $current_tab = (isset($_GET['tab']) && $_GET['tab'] != '') ? $_GET['tab'] : 'general_settings';
27
-            if (!(isset($_REQUEST['action']))) // this will avoide Ajax requests
28
-                geodir_handle_option_form_submit($current_tab); // located in admin function.php
27
+            if (!(isset($_REQUEST['action']))) {
28
+                // this will avoide Ajax requests
29
+                geodir_handle_option_form_submit($current_tab);
30
+            }
31
+            // located in admin function.php
29 32
             /**
30 33
              * Called on the WordPress 'admin_init' hook this hookis used to call everything for the GD settings pages in the admin area.
31 34
              *
@@ -313,8 +316,9 @@  discard block
 block discarded – undo
313 316
     if (!empty($notification) && get_option('geodir_tiny_editor') == '1') {
314 317
 
315 318
         foreach ($notification as $key => $value) {
316
-            if ($value['type'] == 'textarea')
317
-                $notification[$key]['type'] = 'editor';
319
+            if ($value['type'] == 'textarea') {
320
+                            $notification[$key]['type'] = 'editor';
321
+            }
318 322
         }
319 323
 
320 324
     }
@@ -339,8 +343,9 @@  discard block
 block discarded – undo
339 343
     if (!empty($design_setting) && get_option('geodir_tiny_editor') == '1') {
340 344
 
341 345
         foreach ($design_setting as $key => $value) {
342
-            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content')
343
-                $design_setting[$key]['type'] = 'editor';
346
+            if ($value['type'] == 'textarea' && $value['id'] == 'geodir_term_condition_content') {
347
+                            $design_setting[$key]['type'] = 'editor';
348
+            }
344 349
         }
345 350
 
346 351
     }
@@ -715,8 +720,9 @@  discard block
 block discarded – undo
715 720
 
716 721
     if (!get_option('geodir_remove_unnecessary_fields')) {
717 722
 
718
-        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'"))
719
-            $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
723
+        if ($wpdb->get_var("SHOW COLUMNS FROM " . $plugin_prefix . "gd_place_detail WHERE field = 'categories'")) {
724
+                    $wpdb->query("ALTER TABLE `" . $plugin_prefix . "gd_place_detail` DROP `categories`");
725
+        }
720 726
 
721 727
         update_option('geodir_remove_unnecessary_fields', '1');
722 728
 
@@ -742,15 +748,17 @@  discard block
 block discarded – undo
742 748
         $geodir_admin_ajax_action = $_REQUEST['geodir_admin_ajax_action'];
743 749
         switch ($geodir_admin_ajax_action) {
744 750
             case 'diagnosis' :
745
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
746
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
751
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
752
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
753
+                }
747 754
                 call_user_func('geodir_diagnose_' . $diagnose_this);
748 755
                 exit();
749 756
                 break;
750 757
 
751 758
             case 'diagnosis-fix' :
752
-                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '')
753
-                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
759
+                if (isset($_REQUEST['diagnose_this']) && $_REQUEST['diagnose_this'] != '') {
760
+                                    $diagnose_this = sanitize_text_field($_REQUEST['diagnose_this']);
761
+                }
754 762
                 call_user_func('geodir_diagnose_' . $diagnose_this);
755 763
                 exit();
756 764
                 break;
@@ -1308,11 +1316,11 @@  discard block
 block discarded – undo
1308 1316
     //////////////////////////////////
1309 1317
     $option_value = get_option('geodir_home_page');
1310 1318
     $page = get_post($option_value);
1311
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1319
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1312 1320
 
1313
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1314
-        $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1315
-    else {
1321
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1322
+            $output_str .= "<li>" . __('GD Home page exists with proper setting.', 'geodirectory') . "</li>";
1323
+    } else {
1316 1324
         $is_error_during_diagnose = true;
1317 1325
         $output_str .= "<li><strong>" . __('GD Home page is missing.', 'geodirectory') . "</strong></li>";
1318 1326
         if ($fix) {
@@ -1333,11 +1341,11 @@  discard block
 block discarded – undo
1333 1341
     //////////////////////////////////
1334 1342
     $option_value = get_option('geodir_add_listing_page');
1335 1343
     $page = get_post($option_value);
1336
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1344
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1337 1345
 
1338
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1339
-        $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1340
-    else {
1346
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1347
+            $output_str .= "<li>" . __('Add Listing page exists with proper setting.', 'geodirectory') . "</li>";
1348
+    } else {
1341 1349
         $is_error_during_diagnose = true;
1342 1350
         $output_str .= "<li><strong>" . __('Add Listing page is missing.', 'geodirectory') . "</strong></li>";
1343 1351
         if ($fix) {
@@ -1359,11 +1367,11 @@  discard block
 block discarded – undo
1359 1367
     //////////////////////////////////
1360 1368
     $option_value = get_option('geodir_preview_page');
1361 1369
     $page = get_post($option_value);
1362
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1370
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1363 1371
 
1364
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1365
-        $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1366
-    else {
1372
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1373
+            $output_str .= "<li>" . __('Listing Preview page exists with proper setting.', 'geodirectory') . "</li>";
1374
+    } else {
1367 1375
         $is_error_during_diagnose = true;
1368 1376
         $output_str .= "<li><strong>" . __('Listing Preview page is missing.', 'geodirectory') . "</strong></li>";
1369 1377
         if ($fix) {
@@ -1384,11 +1392,11 @@  discard block
 block discarded – undo
1384 1392
     //////////////////////////////////
1385 1393
     $option_value = get_option('geodir_success_page');
1386 1394
     $page = get_post($option_value);
1387
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1395
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1388 1396
 
1389
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1390
-        $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1391
-    else {
1397
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1398
+            $output_str .= "<li>" . __('Listing Success page exists with proper setting.', 'geodirectory') . "</li>";
1399
+    } else {
1392 1400
         $is_error_during_diagnose = true;
1393 1401
         $output_str .= "<li><strong>" . __('Listing Success page is missing.', 'geodirectory') . "</strong></li>";
1394 1402
         if ($fix) {
@@ -1409,11 +1417,11 @@  discard block
 block discarded – undo
1409 1417
     //////////////////////////////////
1410 1418
     $option_value = get_option('geodir_info_page');
1411 1419
     $page = get_post($option_value);
1412
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1420
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1413 1421
 
1414
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1415
-        $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1416
-    else {
1422
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1423
+            $output_str .= "<li>" . __('Info page exists with proper setting.', 'geodirectory') . "</li>";
1424
+    } else {
1417 1425
         $is_error_during_diagnose = true;
1418 1426
         $output_str .= "<li><strong>" . __('Info page is missing.', 'geodirectory') . "</strong></li>";
1419 1427
         if ($fix) {
@@ -1434,11 +1442,11 @@  discard block
 block discarded – undo
1434 1442
     //////////////////////////////////
1435 1443
     $option_value = get_option('geodir_login_page');
1436 1444
     $page = get_post($option_value);
1437
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1445
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1438 1446
 
1439
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1440
-        $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1441
-    else {
1447
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1448
+            $output_str .= "<li>" . __('Login page exists with proper setting.', 'geodirectory') . "</li>";
1449
+    } else {
1442 1450
         $is_error_during_diagnose = true;
1443 1451
         $output_str .= "<li><strong>" . __('Login page is missing.', 'geodirectory') . "</strong></li>";
1444 1452
         if ($fix) {
@@ -1459,11 +1467,11 @@  discard block
 block discarded – undo
1459 1467
     //////////////////////////////////
1460 1468
     $option_value = get_option('geodir_location_page');
1461 1469
     $page = get_post($option_value);
1462
-    if(!empty($page)){$page_found = $page->ID;}else{$page_found = '';}
1470
+    if(!empty($page)){$page_found = $page->ID;} else{$page_found = '';}
1463 1471
 
1464
-    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish')
1465
-        $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1466
-    else {
1472
+    if(!empty($option_value) && !empty($page_found) && $option_value == $page_found && $page->post_status=='publish') {
1473
+            $output_str .= "<li>" . __('Location page exists with proper setting.', 'geodirectory') . "</li>";
1474
+    } else {
1467 1475
         $is_error_during_diagnose = true;
1468 1476
         $output_str .= "<li><strong>" . __('Location page is missing.', 'geodirectory') . "</strong></li>";
1469 1477
         if ($fix) {
@@ -1907,8 +1915,9 @@  discard block
 block discarded – undo
1907 1915
                             );
1908 1916
 
1909 1917
                             $post_location_info = $request_info['post_location'];
1910
-                            if ($location_id = geodir_add_new_location($post_location_info))
1911
-                                $post_location_id = $location_id;
1918
+                            if ($location_id = geodir_add_new_location($post_location_info)) {
1919
+                                                            $post_location_id = $location_id;
1920
+                            }
1912 1921
                         } else {
1913 1922
                             $post_location_id = 0;
1914 1923
                         }
@@ -1971,8 +1980,9 @@  discard block
 block discarded – undo
1971 1980
                             $attachment_set = '';
1972 1981
 
1973 1982
                             foreach ($attachment as $key => $val) {
1974
-                                if ($val != '')
1975
-                                    $attachment_set .= $key . " = '" . $val . "', ";
1983
+                                if ($val != '') {
1984
+                                                                    $attachment_set .= $key . " = '" . $val . "', ";
1985
+                                }
1976 1986
                             }
1977 1987
                             $attachment_set = trim($attachment_set, ", ");
1978 1988
 
@@ -2068,8 +2078,7 @@  discard block
 block discarded – undo
2068 2078
 
2069 2079
         $parts = json_decode($response['body']);
2070 2080
         //print_r($parts);
2071
-        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;}
2072
-        else{
2081
+        if(!isset($parts->access_token)){echo $error_msg." - #1";exit;} else{
2073 2082
 
2074 2083
             update_option('gd_ga_access_token', $parts->access_token);
2075 2084
             update_option('gd_ga_refresh_token', $parts->refresh_token);
@@ -2077,17 +2086,16 @@  discard block
 block discarded – undo
2077 2086
         }
2078 2087
 
2079 2088
 
2080
-    }
2081
-    elseif(!empty($response['response']['code'])) {
2089
+    } elseif(!empty($response['response']['code'])) {
2082 2090
         $parts = json_decode($response['body']);
2083 2091
 
2084 2092
         if(isset($parts->error)){
2085 2093
             echo $parts->error.": ".$parts->error_description;exit;
2086
-        }else{
2094
+        } else{
2087 2095
             echo $error_msg." - #2";exit;
2088 2096
         }
2089 2097
 
2090
-    }else{
2098
+    } else{
2091 2099
 
2092 2100
         echo $error_msg." - #3";exit;
2093 2101
 
Please login to merge, or discard this patch.
geodirectory-admin/admin_template_tags.php 3 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
                         } ?>">
153 153
                             <form method="post" id="mainform"
154 154
                                   class="geodir_optionform <?php echo $current_tab . ' '; ?><?php if (isset($sub['subtab'])) {
155
-                                      echo sanitize_text_field($sub['subtab']);
156
-                                  } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
155
+                                        echo sanitize_text_field($sub['subtab']);
156
+                                    } ?>" action="<?php echo $form_action; ?>" enctype="multipart/form-data">
157 157
                                 <input type="hidden" class="active_tab" name="active_tab"
158 158
                                        value="<?php if (isset($_REQUEST['active_tab'])) {
159
-                                           echo sanitize_text_field($_REQUEST['active_tab']);
160
-                                       } ?>"/>
159
+                                            echo sanitize_text_field($_REQUEST['active_tab']);
160
+                                        } ?>"/>
161 161
                                 <?php wp_nonce_field('geodir-settings', '_wpnonce', true, true); ?>
162 162
                                 <?php wp_nonce_field('geodir-settings-' . $current_tab, '_wpnonce-' . $current_tab, true, true); ?>
163 163
                                 <?php
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
                                     <input class="require" type="text" size="80" style="width:440px"
416 416
                                            id="<?php echo $prefix;?>city" name="city"
417 417
                                            value="<?php if (isset($location_result->city)) {
418
-                                               echo $location_result->city;
419
-                                           } ?>"/>
418
+                                                echo $location_result->city;
419
+                                            } ?>"/>
420 420
 
421 421
                                     <div
422 422
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
                                     <input class="require" type="text" size="80" style="width:440px"
432 432
                                            id="<?php echo $prefix;?>region" name="region"
433 433
                                            value="<?php if (isset($location_result->region)) {
434
-                                               echo $location_result->region;
435
-                                           } ?>"/>
434
+                                                echo $location_result->region;
435
+                                            } ?>"/>
436 436
 
437 437
                                     <div
438 438
                                         class="gd-location_message_error"> <?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
                                     <input type="text" class="require" size="80" style="width:440px"
486 486
                                            id="<?php echo $prefix;?>latitude" name="latitude"
487 487
                                            value="<?php if (isset($location_result->city_latitude)) {
488
-                                               echo $location_result->city_latitude;
489
-                                           } ?>"/>
488
+                                                echo $location_result->city_latitude;
489
+                                            } ?>"/>
490 490
 
491 491
                                     <div
492 492
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
                                     <input type="text" class="require" size="80" style="width:440px"
503 503
                                            id="<?php echo $prefix;?>longitude" name="longitude"
504 504
                                            value="<?php if (isset($location_result->city_longitude)) {
505
-                                               echo $location_result->city_longitude;
506
-                                           } ?>"/>
505
+                                                echo $location_result->city_longitude;
506
+                                            } ?>"/>
507 507
 
508 508
                                     <div
509 509
                                         class="gd-location_message_error"><?php _e('This field is required.', 'geodirectory'); ?></div>
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
         case 'compatibility_settings' :
547 547
             geodir_theme_compatibility_setting_page();
548 548
             break;		
549
-		case 'import_export' :
549
+        case 'import_export' :
550 550
             geodir_import_export_page();
551 551
             break;
552 552
 
Please login to merge, or discard this patch.
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                          * @param array $tabs The array of tabs to display.
53 53
                          */
54 54
                         $tabs = apply_filters('geodir_settings_tabs_array', $tabs);
55
-                        update_option('geodir_tabs', $tabs);// Important to show settings menu dropdown
55
+                        update_option('geodir_tabs', $tabs); // Important to show settings menu dropdown
56 56
 
57 57
                         foreach ($tabs as $name => $args) :
58 58
                             $label = $args['label'];
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
                     jQuery('.geodirectory-nav-tab-wrapper a').click(function () {
223 223
                         if (changed) {
224 224
                             window.onbeforeunload = function () {
225
-                                return '<?php echo __( 'The changes you made will be lost if you navigate away from this page.', 'geodirectory'); ?>';
225
+                                return '<?php echo __('The changes you made will be lost if you navigate away from this page.', 'geodirectory'); ?>';
226 226
                             }
227 227
                         } else {
228 228
                             window.onbeforeunload = '';
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
             ?>
328 328
 
329 329
             <p class="submit">
330
-            <input <?php echo $hide_save_button;?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
330
+            <input <?php echo $hide_save_button; ?> name="save" class="button-primary" type="submit" value="<?php _e('Save changes', 'geodirectory'); ?>" />
331 331
             <input type="hidden" name="subtab" id="last_tab" />
332 332
             </p>
333 333
             
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
                     ?>
398 398
 
399
-                    <h3><?php _e('Set Default Location', 'geodirectory');?></h3>
399
+                    <h3><?php _e('Set Default Location', 'geodirectory'); ?></h3>
400 400
 
401 401
                     <input type="hidden" name="add_location" value="location">
402 402
 
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
                         echo $location_result->location_id;
405 405
                     } ?>">
406 406
 
407
-                    <input type="hidden" name="address" id="<?php echo $prefix;?>address" value="">
407
+                    <input type="hidden" name="address" id="<?php echo $prefix; ?>address" value="">
408 408
 
409 409
                     <table class="form-table default_location_form">
410 410
                         <tbody>
411 411
                         <tr valign="top" class="single_select_page">
412
-                            <th class="titledesc" scope="row"><?php _e('City', 'geodirectory');?></th>
412
+                            <th class="titledesc" scope="row"><?php _e('City', 'geodirectory'); ?></th>
413 413
                             <td class="forminp">
414 414
                                 <div class="gtd-formfeild required">
415 415
                                     <input class="require" type="text" size="80" style="width:440px"
416
-                                           id="<?php echo $prefix;?>city" name="city"
416
+                                           id="<?php echo $prefix; ?>city" name="city"
417 417
                                            value="<?php if (isset($location_result->city)) {
418 418
                                                echo $location_result->city;
419 419
                                            } ?>"/>
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
                             </td>
426 426
                         </tr>
427 427
                         <tr valign="top" class="single_select_page">
428
-                            <th class="titledesc" scope="row"><?php _e('Region', 'geodirectory');?></th>
428
+                            <th class="titledesc" scope="row"><?php _e('Region', 'geodirectory'); ?></th>
429 429
                             <td class="forminp">
430 430
                                 <div class="gtd-formfeild required">
431 431
                                     <input class="require" type="text" size="80" style="width:440px"
432
-                                           id="<?php echo $prefix;?>region" name="region"
432
+                                           id="<?php echo $prefix; ?>region" name="region"
433 433
                                            value="<?php if (isset($location_result->region)) {
434 434
                                                echo $location_result->region;
435 435
                                            } ?>"/>
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
                             </td>
442 442
                         </tr>
443 443
                         <tr valign="top" class="single_select_page">
444
-                            <th class="titledesc" scope="row"><?php _e('Country', 'geodirectory');?></th>
444
+                            <th class="titledesc" scope="row"><?php _e('Country', 'geodirectory'); ?></th>
445 445
                             <td class="forminp">
446 446
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
447 447
                                     <?php
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                                     ?>
451 451
                                     <select id="<?php echo $prefix ?>country" class="chosen_select"
452 452
                                             data-location_type="country" name="<?php echo $prefix ?>country"
453
-                                            data-placeholder="<?php _e('Choose a country.', 'geodirectory');?>"
453
+                                            data-placeholder="<?php _e('Choose a country.', 'geodirectory'); ?>"
454 454
                                             data-addsearchtermonnorecord="1" data-ajaxchosen="0" data-autoredirect="0"
455 455
                                             data-showeverywhere="0">
456 456
                                         <?php geodir_get_country_dl($country, $prefix); ?>
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
                         </tr>
468 468
                         <tr valign="top" class="single_select_page">
469 469
                             <th class="titledesc"
470
-                                scope="row"><?php _e('Set Location on Map', 'geodirectory');?></th>
470
+                                scope="row"><?php _e('Set Location on Map', 'geodirectory'); ?></th>
471 471
                             <td class="forminp">
472 472
                                 <?php
473 473
                                 /**
@@ -475,15 +475,15 @@  discard block
 block discarded – undo
475 475
                                  *
476 476
                                  * @since 1.0.0
477 477
                                  */
478
-                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");?>
478
+                                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php"); ?>
479 479
                             </td>
480 480
                         </tr>
481 481
                         <tr valign="top" class="single_select_page">
482
-                            <th class="titledesc" scope="row"><?php _e('City Latitude', 'geodirectory');?></th>
482
+                            <th class="titledesc" scope="row"><?php _e('City Latitude', 'geodirectory'); ?></th>
483 483
                             <td class="forminp">
484 484
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
485 485
                                     <input type="text" class="require" size="80" style="width:440px"
486
-                                           id="<?php echo $prefix;?>latitude" name="latitude"
486
+                                           id="<?php echo $prefix; ?>latitude" name="latitude"
487 487
                                            value="<?php if (isset($location_result->city_latitude)) {
488 488
                                                echo $location_result->city_latitude;
489 489
                                            } ?>"/>
@@ -496,11 +496,11 @@  discard block
 block discarded – undo
496 496
                         </tr>
497 497
                         <tr valign="top" class="single_select_page">
498 498
                             <th class="titledesc"
499
-                                scope="row"><?php _e('City Longitude', 'geodirectory');?></th>
499
+                                scope="row"><?php _e('City Longitude', 'geodirectory'); ?></th>
500 500
                             <td class="forminp">
501 501
                                 <div class="gtd-formfeild required" style="padding-top:10px;">
502 502
                                     <input type="text" class="require" size="80" style="width:440px"
503
-                                           id="<?php echo $prefix;?>longitude" name="longitude"
503
+                                           id="<?php echo $prefix; ?>longitude" name="longitude"
504 504
                                            value="<?php if (isset($location_result->city_longitude)) {
505 505
                                                echo $location_result->city_longitude;
506 506
                                            } ?>"/>
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
         <div class="gd-content-heading">
777 777
 
778 778
 
779
-            <h3><?php _e('Theme Compatability Settings', 'geodirectory');?></h3>
779
+            <h3><?php _e('Theme Compatability Settings', 'geodirectory'); ?></h3>
780 780
             <style>
781 781
                 .gd-theme-compat-table {
782 782
                     width: 100%;
@@ -807,11 +807,11 @@  discard block
 block discarded – undo
807 807
                 </div>
808 808
             <?php }?>
809 809
 
810
-            <h4><?php _e('Select Theme Compatibility Pack', 'geodirectory');?></h4>
810
+            <h4><?php _e('Select Theme Compatibility Pack', 'geodirectory'); ?></h4>
811 811
 
812 812
             <select name="gd_theme_compat" id="gd_theme_compat">
813
-                <option value=""><?php _e('Select Theme', 'geodirectory');?></option>
814
-                <option value="custom"><?php _e('Custom', 'geodirectory');?></option>
813
+                <option value=""><?php _e('Select Theme', 'geodirectory'); ?></option>
814
+                <option value="custom"><?php _e('Custom', 'geodirectory'); ?></option>
815 815
                 <?php
816 816
                 $theme_arr = get_option('gd_theme_compats');
817 817
                 $theme_active = get_option('gd_theme_compat');
@@ -830,20 +830,20 @@  discard block
 block discarded – undo
830 830
                 ?>
831 831
             </select>
832 832
             <button onclick="gd_comp_export();" type="button"
833
-                    class="button-primary"><?php _e('Export', 'geodirectory');?></button>
833
+                    class="button-primary"><?php _e('Export', 'geodirectory'); ?></button>
834 834
             <button onclick="gd_comp_import();" type="button"
835
-                    class="button-primary"><?php _e('Import', 'geodirectory');?></button>
835
+                    class="button-primary"><?php _e('Import', 'geodirectory'); ?></button>
836 836
 
837 837
             <div class="gd-comp-import-export">
838 838
                 <textarea id="gd-import-export-theme-comp"
839
-                          placeholder="<?php _e('Paste the JSON code here and then click import again', 'geodirectory');?>"></textarea>
839
+                          placeholder="<?php _e('Paste the JSON code here and then click import again', 'geodirectory'); ?>"></textarea>
840 840
             </div>
841 841
             <script>
842 842
 
843 843
                 function gd_comp_export() {
844 844
                     theme = jQuery('#gd_theme_compat').val();
845 845
                     if (theme == '' || theme == 'custom') {
846
-                        alert("<?php _e('Please select a theme to export','geodirectory');?>");
846
+                        alert("<?php _e('Please select a theme to export', 'geodirectory'); ?>");
847 847
                         return false;
848 848
                     }
849 849
                     jQuery('.gd-comp-import-export').show();
@@ -877,9 +877,9 @@  discard block
 block discarded – undo
877 877
 
878 878
                     jQuery.post(ajaxurl, data, function (response) {
879 879
                         if (response == '0') {
880
-                            alert("<?php _e('Something went wrong','geodirectory');?>");
880
+                            alert("<?php _e('Something went wrong', 'geodirectory'); ?>");
881 881
                         } else {
882
-                            alert("<?php _e('Theme Compatibility Imported','geodirectory');?>");
882
+                            alert("<?php _e('Theme Compatibility Imported', 'geodirectory'); ?>");
883 883
                             jQuery('#gd-import-export-theme-comp').val('');
884 884
                             jQuery('.gd-comp-import-export').hide();
885 885
                             jQuery('#gd_theme_compat').append(new Option(response, response));
@@ -920,14 +920,14 @@  discard block
 block discarded – undo
920 920
 
921 921
             </script>
922 922
 
923
-            <h4><?php _e('Main Wrapper Actions', 'geodirectory');?></h4>
923
+            <h4><?php _e('Main Wrapper Actions', 'geodirectory'); ?></h4>
924 924
 
925 925
             <table class="form-table gd-theme-compat-table">
926 926
                 <tbody>
927 927
                 <tr>
928
-                    <td><strong><?php _e('Hook', 'geodirectory');?></strong></td>
929
-                    <td><strong><?php _e('ID', 'geodirectory');?></strong></td>
930
-                    <td><strong><?php _e('Class', 'geodirectory');?></strong></td>
928
+                    <td><strong><?php _e('Hook', 'geodirectory'); ?></strong></td>
929
+                    <td><strong><?php _e('ID', 'geodirectory'); ?></strong></td>
930
+                    <td><strong><?php _e('Class', 'geodirectory'); ?></strong></td>
931 931
                 </tr>
932 932
 
933 933
 
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 
946 946
                 <tr class="gd-theme-comp-out">
947 947
                     <td colspan="3">
948
-                        <span><?php _e('Output:', 'geodirectory');?></span>
948
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
949 949
                         <textarea name="geodir_wrapper_open_replace"
950 950
                                   placeholder='<div id="[id]" class="[class]">'><?php if (isset($tc['geodir_wrapper_open_replace'])) {
951 951
                                 echo $tc['geodir_wrapper_open_replace'];
@@ -959,14 +959,14 @@  discard block
 block discarded – undo
959 959
                         <small>geodir_wrapper_close</small>
960 960
                     </td>
961 961
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_open_id"
962
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
962
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
963 963
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_open_class"
964
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
964
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
965 965
                 </tr>
966 966
 
967 967
                 <tr class="gd-theme-comp-out">
968 968
                     <td colspan="3">
969
-                        <span><?php _e('Output:', 'geodirectory');?></span>
969
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
970 970
                         <textarea name="geodir_wrapper_close_replace"
971 971
                                   placeholder='</div><!-- wrapper ends here-->'><?php if (isset($tc['geodir_wrapper_close_replace'])) {
972 972
                                 echo $tc['geodir_wrapper_close_replace'];
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 
991 991
                 <tr class="gd-theme-comp-out">
992 992
                     <td colspan="3">
993
-                        <span><?php _e('Output:', 'geodirectory');?></span>
993
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
994 994
                         <textarea name="geodir_wrapper_content_open_replace"
995 995
                                   placeholder='<div id="[id]" class="[class]" role="main" [width_css]>'><?php if (isset($tc['geodir_wrapper_content_open_replace'])) {
996 996
                                 echo $tc['geodir_wrapper_content_open_replace'];
@@ -1004,14 +1004,14 @@  discard block
 block discarded – undo
1004 1004
                         <small>geodir_wrapper_content_close</small>
1005 1005
                     </td>
1006 1006
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_content_close_id"
1007
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1007
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1008 1008
                     <td><input disabled="disabled" type="text" name="geodir_wrapper_content_close_class"
1009
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1009
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1010 1010
                 </tr>
1011 1011
 
1012 1012
                 <tr class="gd-theme-comp-out">
1013 1013
                     <td colspan="3">
1014
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1014
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1015 1015
                         <textarea name="geodir_wrapper_content_close_replace"
1016 1016
                                   placeholder='</div><!-- content ends here-->'><?php if (isset($tc['geodir_wrapper_content_close_replace'])) {
1017 1017
                                 echo $tc['geodir_wrapper_content_close_replace'];
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 
1034 1034
                 <tr class="gd-theme-comp-out">
1035 1035
                     <td colspan="3">
1036
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1036
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1037 1037
                         <textarea name="geodir_article_open_replace"
1038 1038
                                   placeholder='<article  id="[id]" class="[class]" itemscope itemtype="[itemtype]">'><?php if (isset($tc['geodir_article_open_replace'])) {
1039 1039
                                 echo $tc['geodir_article_open_replace'];
@@ -1046,14 +1046,14 @@  discard block
 block discarded – undo
1046 1046
                         <small>geodir_article_close</small>
1047 1047
                     </td>
1048 1048
                     <td><input disabled="disabled" type="text" name="geodir_article_close_id"
1049
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1049
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1050 1050
                     <td><input disabled="disabled" type="text" name="geodir_article_close_class"
1051
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1051
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1052 1052
                 </tr>
1053 1053
 
1054 1054
                 <tr class="gd-theme-comp-out">
1055 1055
                     <td colspan="3">
1056
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1056
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1057 1057
                         <textarea name="geodir_article_close_replace"
1058 1058
                                   placeholder='</article><!-- article ends here-->'><?php if (isset($tc['geodir_article_close_replace'])) {
1059 1059
                                 echo $tc['geodir_article_close_replace'];
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 
1077 1077
                 <tr class="gd-theme-comp-out">
1078 1078
                     <td colspan="3">
1079
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1079
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1080 1080
                         <textarea name="geodir_sidebar_right_open_replace"
1081 1081
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_right_open_replace'])) {
1082 1082
                                 echo $tc['geodir_sidebar_right_open_replace'];
@@ -1089,14 +1089,14 @@  discard block
 block discarded – undo
1089 1089
                         <small>geodir_sidebar_right_close</small>
1090 1090
                     </td>
1091 1091
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_right_close_id"
1092
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1092
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1093 1093
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_right_close_class"
1094
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1094
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1095 1095
                 </tr>
1096 1096
 
1097 1097
                 <tr class="gd-theme-comp-out">
1098 1098
                     <td colspan="3">
1099
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1099
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1100 1100
                         <textarea name="geodir_sidebar_right_close_replace"
1101 1101
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_right_close_replace'])) {
1102 1102
                                 echo $tc['geodir_sidebar_right_close_replace'];
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
                 <tr class="gd-theme-comp-out">
1122 1122
                     <td colspan="3">
1123
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1123
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1124 1124
                         <textarea name="geodir_sidebar_left_open_replace"
1125 1125
                                   placeholder='<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>'><?php if (isset($tc['geodir_sidebar_left_open_replace'])) {
1126 1126
                                 echo $tc['geodir_sidebar_left_open_replace'];
@@ -1133,14 +1133,14 @@  discard block
 block discarded – undo
1133 1133
                         <small>geodir_sidebar_left_close</small>
1134 1134
                     </td>
1135 1135
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_left_close_id"
1136
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1136
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1137 1137
                     <td><input disabled="disabled" type="text" name="geodir_sidebar_left_close_class"
1138
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1138
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1139 1139
                 </tr>
1140 1140
 
1141 1141
                 <tr class="gd-theme-comp-out">
1142 1142
                     <td colspan="3">
1143
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1143
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1144 1144
                         <textarea name="geodir_sidebar_left_close_replace"
1145 1145
                                   placeholder='</aside><!-- sidebar ends here-->'><?php if (isset($tc['geodir_sidebar_left_close_replace'])) {
1146 1146
                                 echo $tc['geodir_sidebar_left_close_replace'];
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 
1163 1163
                 <tr class="gd-theme-comp-out">
1164 1164
                     <td colspan="3">
1165
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1165
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1166 1166
                         <textarea name="geodir_main_content_open_replace"
1167 1167
                                   placeholder='<main  id="[id]" class="[class]"  role="main">'><?php if (isset($tc['geodir_main_content_open_replace'])) {
1168 1168
                                 echo $tc['geodir_main_content_open_replace'];
@@ -1175,14 +1175,14 @@  discard block
 block discarded – undo
1175 1175
                         <small>geodir_main_content_close</small>
1176 1176
                     </td>
1177 1177
                     <td><input disabled="disabled" type="text" name="geodir_main_content_close_id"
1178
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1178
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1179 1179
                     <td><input disabled="disabled" type="text" name="geodir_main_content_close_class"
1180
-                               placeholder="<?php _e('Not used', 'geodirectory');?>"/></td>
1180
+                               placeholder="<?php _e('Not used', 'geodirectory'); ?>"/></td>
1181 1181
                 </tr>
1182 1182
 
1183 1183
                 <tr class="gd-theme-comp-out">
1184 1184
                     <td colspan="3">
1185
-                        <span><?php _e('Output:', 'geodirectory');?></span>
1185
+                        <span><?php _e('Output:', 'geodirectory'); ?></span>
1186 1186
                         <textarea name="geodir_main_content_close_replace"
1187 1187
                                   placeholder='</main><!-- main ends here-->'><?php if (isset($tc['geodir_main_content_close_replace'])) {
1188 1188
                                 echo $tc['geodir_main_content_close_replace'];
@@ -1194,13 +1194,13 @@  discard block
 block discarded – undo
1194 1194
                 </tbody>
1195 1195
             </table>
1196 1196
 
1197
-            <h4><?php _e('Other Actions', 'geodirectory');?></h4>
1197
+            <h4><?php _e('Other Actions', 'geodirectory'); ?></h4>
1198 1198
 
1199 1199
             <table class="form-table gd-theme-compat-table">
1200 1200
                 <tbody>
1201 1201
                 <tr>
1202
-                    <td><strong><?php _e('Hook', 'geodirectory');?></strong></td>
1203
-                    <td><strong><?php _e('Content', 'geodirectory');?></strong></td>
1202
+                    <td><strong><?php _e('Hook', 'geodirectory'); ?></strong></td>
1203
+                    <td><strong><?php _e('Content', 'geodirectory'); ?></strong></td>
1204 1204
                 </tr>
1205 1205
 
1206 1206
 
@@ -1229,13 +1229,13 @@  discard block
 block discarded – undo
1229 1229
             </table>
1230 1230
 
1231 1231
 
1232
-            <h4><?php _e('Other Filters', 'geodirectory');?></h4>
1232
+            <h4><?php _e('Other Filters', 'geodirectory'); ?></h4>
1233 1233
 
1234 1234
             <table class="form-table gd-theme-compat-table">
1235 1235
                 <tbody>
1236 1236
                 <tr>
1237
-                    <td><strong><?php _e('Filter', 'geodirectory');?></strong></td>
1238
-                    <td><strong><?php _e('Content', 'geodirectory');?></strong></td>
1237
+                    <td><strong><?php _e('Filter', 'geodirectory'); ?></strong></td>
1238
+                    <td><strong><?php _e('Content', 'geodirectory'); ?></strong></td>
1239 1239
                 </tr>
1240 1240
 
1241 1241
                 <tr>
@@ -1389,13 +1389,13 @@  discard block
 block discarded – undo
1389 1389
                  *
1390 1390
                  * @since 1.4.0
1391 1391
                  */
1392
-                do_action('gd_compat_other_filters');?>
1392
+                do_action('gd_compat_other_filters'); ?>
1393 1393
 
1394 1394
                 </tbody>
1395 1395
             </table>
1396 1396
 
1397 1397
 
1398
-            <h4><?php _e('Required CSS', 'geodirectory');?></h4>
1398
+            <h4><?php _e('Required CSS', 'geodirectory'); ?></h4>
1399 1399
 
1400 1400
             <table class="form-table gd-theme-compat-table">
1401 1401
                 <tbody>
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
                 </tbody>
1411 1411
             </table>
1412 1412
 
1413
-            <h4><?php _e('Required JS', 'geodirectory');?></h4>
1413
+            <h4><?php _e('Required JS', 'geodirectory'); ?></h4>
1414 1414
 
1415 1415
             <table class="form-table gd-theme-compat-table">
1416 1416
                 <tbody>
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
 
1429 1429
             <p class="submit">
1430 1430
                 <input name="save" class="button-primary" type="submit"
1431
-                       value="<?php _e('Save changes', 'geodirectory');?>">
1431
+                       value="<?php _e('Save changes', 'geodirectory'); ?>">
1432 1432
             </p>
1433 1433
 
1434 1434
         </div>
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
          * @param string $listing_type Post type.
1463 1463
          */
1464 1464
         ?>
1465
-        <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type);?></h3>
1465
+        <h3><?php echo apply_filters('geodir_custom_fields_panel_head', '', $sub_tab, $listing_type); ?></h3>
1466 1466
     </div>
1467 1467
     <div id="container_general" class="clearfix">
1468 1468
         <div class="general-form-builder-frame">
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
                  * @param string $listing_type Post type.
1478 1478
                  */
1479 1479
                 ?>
1480
-                <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type);?>
1480
+                <h3 class="hndle"><span><?php echo apply_filters('geodir_cf_panel_available_fields_head', '', $sub_tab, $listing_type); ?>
1481 1481
 							</span></h3>
1482 1482
                 <?php
1483 1483
                 /**
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
                  * @param string $listing_type Post type.
1489 1489
                  */
1490 1490
                 ?>
1491
-                <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type);?></p>
1491
+                <p><?php echo apply_filters('geodir_cf_panel_available_fields_note', '', $sub_tab, $listing_type); ?></p>
1492 1492
 
1493 1493
                 <div class="inside">
1494 1494
 
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
                      * @param string $listing_type Post type.
1523 1523
                      */
1524 1524
                     ?>
1525
-                    <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type);?></span>
1525
+                    <span><?php echo apply_filters('geodir_cf_panel_selected_fields_head', '', $sub_tab, $listing_type); ?></span>
1526 1526
                 </h3>
1527 1527
                 <?php
1528 1528
                 /**
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
                  * @param string $listing_type Post type.
1534 1534
                  */
1535 1535
                 ?>
1536
-                <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type);?></p>
1536
+                <p><?php echo apply_filters('geodir_cf_panel_selected_fields_note', '', $sub_tab, $listing_type); ?></p>
1537 1537
 
1538 1538
                 <div class="inside">
1539 1539
 
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
         <div class="gd-content-heading">
1575 1575
 
1576 1576
 
1577
-            <h3><?php _e('GD Diagnostic Tools', 'geodirectory');?></h3>
1577
+            <h3><?php _e('GD Diagnostic Tools', 'geodirectory'); ?></h3>
1578 1578
             <style>
1579 1579
                 .gd-tools-table {
1580 1580
                     width: 100%;
@@ -1593,81 +1593,81 @@  discard block
 block discarded – undo
1593 1593
             <table class="form-table gd-tools-table">
1594 1594
                 <tbody>
1595 1595
                 <tr>
1596
-                    <td><strong><?php _e('Tool', 'geodirectory');?></strong></td>
1597
-                    <td><strong><?php _e('Description', 'geodirectory');?></strong></td>
1598
-                    <td><strong><?php _e('Action', 'geodirectory');?></strong></td>
1596
+                    <td><strong><?php _e('Tool', 'geodirectory'); ?></strong></td>
1597
+                    <td><strong><?php _e('Description', 'geodirectory'); ?></strong></td>
1598
+                    <td><strong><?php _e('Action', 'geodirectory'); ?></strong></td>
1599 1599
                 </tr>
1600 1600
 
1601 1601
 
1602 1602
                 <tr>
1603
-                    <td><?php _e('GD pages check', 'geodirectory');?></td>
1603
+                    <td><?php _e('GD pages check', 'geodirectory'); ?></td>
1604 1604
                     <td>
1605
-                        <small><?php _e('Checks if the GD pages are installed correctly or not.', 'geodirectory');?></small>
1605
+                        <small><?php _e('Checks if the GD pages are installed correctly or not.', 'geodirectory'); ?></small>
1606 1606
                     </td>
1607 1607
                     <td>
1608
-                        <input type="button" value="<?php _e('Run', 'geodirectory');?>"
1608
+                        <input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1609 1609
                                class="button-primary geodir_diagnosis_button" data-diagnose="default_pages"/>
1610 1610
                     </td>
1611 1611
                 </tr>
1612 1612
 
1613 1613
 
1614 1614
                 <tr>
1615
-                    <td><?php _e('Multisite DB conversion check', 'geodirectory');?></td>
1615
+                    <td><?php _e('Multisite DB conversion check', 'geodirectory'); ?></td>
1616 1616
                     <td>
1617
-                        <small><?php _e('Checks if the GD database tables have been converted to use multisite correctly.', 'geodirectory');?></small>
1617
+                        <small><?php _e('Checks if the GD database tables have been converted to use multisite correctly.', 'geodirectory'); ?></small>
1618 1618
                     </td>
1619
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1619
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1620 1620
                                class="button-primary geodir_diagnosis_button" data-diagnose="multisite_conversion"/>
1621 1621
                     </td>
1622 1622
                 </tr>
1623 1623
 
1624 1624
                 <tr>
1625
-                    <td><?php _e('Ratings check', 'geodirectory');?></td>
1625
+                    <td><?php _e('Ratings check', 'geodirectory'); ?></td>
1626 1626
                     <td>
1627
-                        <small><?php _e('Checks ratings for correct location and content settings', 'geodirectory');?></small>
1627
+                        <small><?php _e('Checks ratings for correct location and content settings', 'geodirectory'); ?></small>
1628 1628
                     </td>
1629
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1629
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1630 1630
                                class="button-primary geodir_diagnosis_button" data-diagnose="ratings"/>
1631 1631
                     </td>
1632 1632
                 </tr>
1633 1633
 
1634 1634
                 <tr>
1635
-                    <td><?php _e('Sync GD tags', 'geodirectory');?></td>
1635
+                    <td><?php _e('Sync GD tags', 'geodirectory'); ?></td>
1636 1636
                     <td>
1637
-                        <small><?php _e('This tool can be used when tags are showing in the backend but missing from the front end.', 'geodirectory');?></small>
1637
+                        <small><?php _e('This tool can be used when tags are showing in the backend but missing from the front end.', 'geodirectory'); ?></small>
1638 1638
                     </td>
1639
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1639
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1640 1640
                                class="button-primary geodir_diagnosis_button" data-diagnose="tags_sync"/>
1641 1641
                     </td>
1642 1642
                 </tr>
1643 1643
 
1644 1644
                 <tr>
1645
-                    <td><?php _e('Sync GD Categories', 'geodirectory');?></td>
1645
+                    <td><?php _e('Sync GD Categories', 'geodirectory'); ?></td>
1646 1646
                     <td>
1647
-                        <small><?php _e('This tool can be used when categories are missing from the details table but showing in other places in the backend (only checks posts with missing category info in details table)', 'geodirectory');?></small>
1647
+                        <small><?php _e('This tool can be used when categories are missing from the details table but showing in other places in the backend (only checks posts with missing category info in details table)', 'geodirectory'); ?></small>
1648 1648
                     </td>
1649
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1649
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1650 1650
                                class="button-primary geodir_diagnosis_button" data-diagnose="cats_sync"/>
1651 1651
                     </td>
1652 1652
                 </tr>
1653 1653
 
1654 1654
 
1655 1655
                 <tr>
1656
-                    <td><?php _e('Clear all GD version numbers', 'geodirectory');?></td>
1656
+                    <td><?php _e('Clear all GD version numbers', 'geodirectory'); ?></td>
1657 1657
                     <td>
1658
-                        <small><?php _e('This tool will clear all GD version numbers so any upgrade functions will run again.', 'geodirectory');?></small>
1658
+                        <small><?php _e('This tool will clear all GD version numbers so any upgrade functions will run again.', 'geodirectory'); ?></small>
1659 1659
                     </td>
1660
-                    <td><input type="button" value="<?php _e('Run', 'geodirectory');?>"
1660
+                    <td><input type="button" value="<?php _e('Run', 'geodirectory'); ?>"
1661 1661
                                class="button-primary geodir_diagnosis_button" data-diagnose="version_clear"/>
1662 1662
                     </td>
1663 1663
                 </tr>
1664 1664
 				<tr>
1665
-					<td><?php _e('Load custom fields translation', 'geodirectory');?></td>
1665
+					<td><?php _e('Load custom fields translation', 'geodirectory'); ?></td>
1666 1666
 					<td>
1667
-						<small><?php _e('This tool will load strings from the database into a file to translate via po editor.Ex: custom fields', 'geodirectory');?></small>
1667
+						<small><?php _e('This tool will load strings from the database into a file to translate via po editor.Ex: custom fields', 'geodirectory'); ?></small>
1668 1668
 					</td>
1669 1669
 					<td>
1670
-						<input type="button" value="<?php _e('Run', 'geodirectory');?>" class="button-primary geodir_diagnosis_button" data-diagnose="load_db_language"/>
1670
+						<input type="button" value="<?php _e('Run', 'geodirectory'); ?>" class="button-primary geodir_diagnosis_button" data-diagnose="load_db_language"/>
1671 1671
 					</td>
1672 1672
 				</tr>
1673 1673
                 <?php
@@ -1677,7 +1677,7 @@  discard block
 block discarded – undo
1677 1677
                  * Called after the last setting on the GD>Tools page.
1678 1678
                  * @since 1.0.0
1679 1679
                  */
1680
-                do_action('geodir_diagnostic_tool');?>
1680
+                do_action('geodir_diagnostic_tool'); ?>
1681 1681
 
1682 1682
                 </tbody>
1683 1683
             </table>
Please login to merge, or discard this patch.
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -74,17 +74,20 @@  discard block
 block discarded – undo
74 74
                                 $tab_link = $args['url'];
75 75
                             }
76 76
 
77
-                            if (!empty($args['request']))
78
-                                $tab_link = geodir_getlink($tab_link, $args['request']);
77
+                            if (!empty($args['request'])) {
78
+                                                            $tab_link = geodir_getlink($tab_link, $args['request']);
79
+                            }
79 80
 
80 81
                             if (isset($args['target']) && $args['target'] != '') {
81 82
                                 $tab_target = " target='" . sanitize_text_field($args['target']) . "' ";
82
-                            } else
83
-                                $tab_target = '';
83
+                            } else {
84
+                                                            $tab_target = '';
85
+                            }
84 86
 
85 87
                             $tab_active = '';
86
-                            if ($current_tab == $name)
87
-                                $tab_active = ' class="tab-active" ';
88
+                            if ($current_tab == $name) {
89
+                                                            $tab_active = ' class="tab-active" ';
90
+                            }
88 91
                             /**
89 92
                              * Called before the individual settings tabs are output.
90 93
                              *
@@ -122,8 +125,9 @@  discard block
 block discarded – undo
122 125
 
123 126
                         <?php
124 127
                         unset($subtabs);
125
-                        if (isset($tabs[$current_tab]['subtabs']))
126
-                            $subtabs = $tabs[$current_tab]['subtabs'];
128
+                        if (isset($tabs[$current_tab]['subtabs'])) {
129
+                                                    $subtabs = $tabs[$current_tab]['subtabs'];
130
+                        }
127 131
                         $form_action = '';
128 132
 
129 133
                         if (!empty($subtabs)):
@@ -189,7 +193,10 @@  discard block
 block discarded – undo
189 193
                      jQuery('#last_tab').val( jQuery(this).attr('href') );
190 194
                      return false;*/
191 195
                 });
192
-                <?php if (isset($_GET['subtab']) && $_GET['subtab']) echo 'jQuery("ul.subsubsub li a[href=#' . sanitize_text_field($_GET['subtab']) . ']").click();'; ?>
196
+                <?php if (isset($_GET['subtab']) && $_GET['subtab']) {
197
+    echo 'jQuery("ul.subsubsub li a[href=#' . sanitize_text_field($_GET['subtab']) . ']").click();';
198
+}
199
+?>
193 200
                 // Countries
194 201
                 jQuery('select#geodirectory_allowed_countries').change(function () {
195 202
                     if (jQuery(this).val() == "specific") {
@@ -312,10 +319,11 @@  discard block
 block discarded – undo
312 319
                 geodir_register_defaults();
313 320
             }*/
314 321
 
315
-            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings'))
316
-                $hide_save_button = "style='display:none;'";
317
-            else
318
-                $hide_save_button = '';
322
+            if (isset($_REQUEST['active_tab']) && ($_REQUEST['active_tab'] == 'dummy_data_settings' || $_REQUEST['active_tab'] == 'csv_upload_settings')) {
323
+                            $hide_save_button = "style='display:none;'";
324
+            } else {
325
+                            $hide_save_button = '';
326
+            }
319 327
 
320 328
             /**
321 329
              * Filter weather the default save button in the GD admin settings pages should be shown.
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/create_field.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,23 +35,26 @@  discard block
 block discarded – undo
35 35
 
36 36
 /* ---- Delete field ---- */
37 37
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
38
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
39
-        return;
38
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
39
+            return;
40
+    }
40 41
     
41 42
     echo geodir_custom_field_delete($field_id);
42 43
 }
43 44
 
44 45
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
45
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
46
-        return;
46
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
47
+            return;
48
+    }
47 49
     
48 50
     echo geodir_custom_sort_field_delete($field_id);
49 51
 }
50 52
 
51 53
 /* ---- Save field  ---- */
52 54
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
53
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
54
-        return;
55
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
56
+            return;
57
+    }
55 58
 
56 59
     foreach ($_REQUEST as $pkey => $pval) {
57 60
         if (is_array($_REQUEST[$pkey])) {
@@ -77,8 +80,9 @@  discard block
 block discarded – undo
77 80
 
78 81
 /* ---- Save sort field  ---- */
79 82
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
80
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
81
-        return;
83
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id)) {
84
+            return;
85
+    }
82 86
 
83 87
     foreach ($_REQUEST as $pkey => $pval) {
84 88
         if (is_array($_REQUEST[$pkey])) {
Please login to merge, or discard this patch.
geodirectory-functions/ajax_handler_functions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function geodir_on_wp()
46 46
 {
47
-    if(geodir_is_page('login')) {
47
+    if (geodir_is_page('login')) {
48 48
         geodir_user_signup();
49 49
     }
50 50
 
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
         if (is_user_logged_in()) {
229 229
             switch ($_REQUEST['ajax_action']):
230 230
                 case "add" :
231
-                    geodir_add_to_favorite((int)$_REQUEST['pid']);
231
+                    geodir_add_to_favorite((int) $_REQUEST['pid']);
232 232
                     break;
233 233
                 case "remove" :
234
-                    geodir_remove_from_favorite((int)$_REQUEST['pid']);
234
+                    geodir_remove_from_favorite((int) $_REQUEST['pid']);
235 235
                     break;
236 236
             endswitch;
237 237
         } else {
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
         $is_current_user_owner = true;
246 246
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
247
-            $is_current_user_owner = geodir_listing_belong_to_current_user((int)$_REQUEST['pid']);
247
+            $is_current_user_owner = geodir_listing_belong_to_current_user((int) $_REQUEST['pid']);
248 248
         }
249 249
 
250 250
         $request = $gd_session->get('listing');
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_functions.php 3 patches
Indentation   +318 added lines, -318 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Custom fields functions
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- * @global object $wpdb WordPress Database object.
8
- * @global string $table_prefix WordPress Database Table prefix.
9
- */
3
+                     * Custom fields functions
4
+                     *
5
+                     * @since 1.0.0
6
+                     * @package GeoDirectory
7
+                     * @global object $wpdb WordPress Database object.
8
+                     * @global string $table_prefix WordPress Database Table prefix.
9
+                     */
10 10
 global $wpdb, $table_prefix;
11 11
 
12 12
 if (!function_exists('geodir_column_exist')) {
13
-	/**
14
-	 * Check table column exist or not.
15
-	 *
16
-	 * @since 1.0.0
17
-	 * @package GeoDirectory
13
+    /**
14
+     * Check table column exist or not.
15
+     *
16
+     * @since 1.0.0
17
+     * @package GeoDirectory
18 18
      * @global object $wpdb WordPress Database object.
19
-	 * @param string $db The table name.
20
-	 * @param string $column The column name.
21
-	 * @return bool If column exists returns true. Otherwise false.
22
-	 */
23
-	function geodir_column_exist($db, $column)
19
+     * @param string $db The table name.
20
+     * @param string $column The column name.
21
+     * @return bool If column exists returns true. Otherwise false.
22
+     */
23
+    function geodir_column_exist($db, $column)
24 24
     {
25 25
         global $wpdb;
26 26
         $exists = false;
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
 }
37 37
 
38 38
 if (!function_exists('geodir_add_column_if_not_exist')) {
39
-	/**
40
-	 * Add column if table column not exist.
41
-	 *
42
-	 * @since 1.0.0
43
-	 * @package GeoDirectory
39
+    /**
40
+     * Add column if table column not exist.
41
+     *
42
+     * @since 1.0.0
43
+     * @package GeoDirectory
44 44
      * @global object $wpdb WordPress Database object.
45
-	 * @param string $db The table name.
46
-	 * @param string $column The column name.
47
-	 * @param string $column_attr The column attributes.
48
-	 */
49
-	function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
45
+     * @param string $db The table name.
46
+     * @param string $column The column name.
47
+     * @param string $column_attr The column attributes.
48
+     */
49
+    function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50 50
     {
51 51
         global $wpdb;
52 52
         $result = 0;// no rows affected
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
 }
153 153
 
154 154
 if (!function_exists('geodir_custom_field_adminhtml')) {
155
-	/**
156
-	 * Adds admin html for custom fields.
157
-	 *
158
-	 * @since 1.0.0
159
-	 * @package GeoDirectory
155
+    /**
156
+     * Adds admin html for custom fields.
157
+     *
158
+     * @since 1.0.0
159
+     * @package GeoDirectory
160 160
      * @global object $wpdb WordPress Database object.
161
-	 * @param string $field_type The form field type.
162
-	 * @param object|int $result_str The custom field results object or row id.
163
-	 * @param string $field_ins_upd When set to "submit" displays form.
164
-	 * @param bool $default when set to true field will be for admin use only.
165
-	 */
166
-	function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
161
+     * @param string $field_type The form field type.
162
+     * @param object|int $result_str The custom field results object or row id.
163
+     * @param string $field_ins_upd When set to "submit" displays form.
164
+     * @param bool $default when set to true field will be for admin use only.
165
+     */
166
+    function geodir_custom_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
167 167
     {
168 168
         global $wpdb;
169 169
         $cf = $result_str;
@@ -186,32 +186,32 @@  discard block
 block discarded – undo
186 186
 }
187 187
 
188 188
 if (!function_exists('geodir_custom_field_delete')) {
189
-	/**
190
-	 * Delete custom field using field id.
191
-	 *
192
-	 * @since 1.0.0
193
-	 * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
194
-	 * @package GeoDirectory
189
+    /**
190
+     * Delete custom field using field id.
191
+     *
192
+     * @since 1.0.0
193
+     * @since 1.5.7 Delete field from sorting fields table when custom field deleted.
194
+     * @package GeoDirectory
195 195
      * @global object $wpdb WordPress Database object.
196 196
      * @global string $plugin_prefix Geodirectory plugin table prefix.
197
-	 * @param string $field_id The custom field ID.
198
-	 * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
199
-	 */
200
-	function geodir_custom_field_delete($field_id = '') {
197
+     * @param string $field_id The custom field ID.
198
+     * @return int|string If field deleted successfully, returns field id. Otherwise returns 0.
199
+     */
200
+    function geodir_custom_field_delete($field_id = '') {
201 201
         global $wpdb, $plugin_prefix;
202 202
         
203
-		if ($field_id != '') {
203
+        if ($field_id != '') {
204 204
             $cf = trim($field_id, '_');
205 205
 
206 206
             if ($field = $wpdb->get_row($wpdb->prepare("select htmlvar_name,post_type,field_type from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d", array($cf)))) {
207 207
                 $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_FIELDS_TABLE . " where id= %d ", array($cf)));
208 208
 
209 209
                 $post_type = $field->post_type;
210
-				$htmlvar_name = $field->htmlvar_name;
210
+                $htmlvar_name = $field->htmlvar_name;
211 211
 				
212
-				if ($post_type != '' && $htmlvar_name != '') {
213
-					$wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
214
-				}
212
+                if ($post_type != '' && $htmlvar_name != '') {
213
+                    $wpdb->query($wpdb->prepare("DELETE FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE htmlvar_name=%s AND post_type=%s LIMIT 1", array($htmlvar_name, $post_type)));
214
+                }
215 215
 
216 216
                 /**
217 217
                  * Called after a custom field is deleted.
@@ -248,15 +248,15 @@  discard block
 block discarded – undo
248 248
 }
249 249
 
250 250
 if (!function_exists('geodir_custom_field_save')) {
251
-	/**
252
-	 * Save or Update custom fields into the database.
253
-	 *
254
-	 * @since 1.0.0
251
+    /**
252
+     * Save or Update custom fields into the database.
253
+     *
254
+     * @since 1.0.0
255 255
      * @since 1.5.6 Fix for saving multiselect custom field "Display Type" on first attempt.
256
-	 * @package GeoDirectory
256
+     * @package GeoDirectory
257 257
      * @global object $wpdb WordPress Database object.
258 258
      * @global string $plugin_prefix Geodirectory plugin table prefix.
259
-	 * @param array $request_field {
259
+     * @param array $request_field {
260 260
      *    Attributes of the request field array.
261 261
      *
262 262
      *    @type string $action Ajax Action name. Default "geodir_ajax_action".
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
      *    @type string $css_class Enter custom css class for field custom style.
290 290
      *
291 291
      * }
292
-	 * @param bool $default Not yet implemented.
293
-	 * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
-	 */
295
-	function geodir_custom_field_save($request_field = array(), $default = false)
292
+     * @param bool $default Not yet implemented.
293
+     * @return int|string If field is unique returns inserted row id. Otherwise returns error string.
294
+     */
295
+    function geodir_custom_field_save($request_field = array(), $default = false)
296 296
     {
297 297
 
298 298
         global $wpdb, $plugin_prefix;
@@ -976,27 +976,27 @@  discard block
 block discarded – undo
976 976
                         if (isset($option_values) && $option_values && $field_type == 'select') {
977 977
                             $option_values_arr = explode(',', $option_values);
978 978
                             
979
-							if (is_array($option_values_arr)) {
979
+                            if (is_array($option_values_arr)) {
980 980
                                 $op_max = 0;
981 981
                                 
982
-								foreach ($option_values_arr as $op_val) {
982
+                                foreach ($option_values_arr as $op_val) {
983 983
                                     if (strlen($op_val) && strlen($op_val) > $op_max) {
984
-										$op_max = strlen($op_val);
985
-									}
984
+                                        $op_max = strlen($op_val);
985
+                                    }
986 986
                                 }
987 987
                                 
988
-								if ($op_max) {
989
-									$op_size = $op_max;
990
-								}
988
+                                if ($op_max) {
989
+                                    $op_size = $op_max;
990
+                                }
991 991
                             }
992 992
                         } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
993 993
                             if (strlen($option_values)) {
994 994
                                 $op_size =  strlen($option_values);
995 995
                             }
996 996
 							
997
-							if (isset($request_field['multi_display_type'])) {
998
-								$extra_fields = $request_field['multi_display_type'];
999
-							}
997
+                            if (isset($request_field['multi_display_type'])) {
998
+                                $extra_fields = $request_field['multi_display_type'];
999
+                            }
1000 1000
                         }
1001 1001
 
1002 1002
                         $meta_field_add = $data_type . "( $op_size ) NULL ";
@@ -1214,10 +1214,10 @@  discard block
 block discarded – undo
1214 1214
     $custom_fields = geodir_post_custom_fields($package_id, $default, $post_type);
1215 1215
 
1216 1216
     $fieldset_id = '';
1217
-	$fieldset_field_class = 'gd-fieldset-details';
1218
-	foreach ($custom_fields as $key => $val) {
1217
+    $fieldset_field_class = 'gd-fieldset-details';
1218
+    foreach ($custom_fields as $key => $val) {
1219 1219
         $val = stripslashes_deep($val); // strip slashes from labels
1220
-		$name = $val['name'];
1220
+        $name = $val['name'];
1221 1221
         $site_title = $val['site_title'];
1222 1222
         $type = $val['type'];
1223 1223
         $admin_desc = $val['desc'];
@@ -1582,15 +1582,15 @@  discard block
 block discarded – undo
1582 1582
 				<?php if ($option_values) {
1583 1583
                     $option_values = geodir_string_values_to_options($option_values, true);
1584 1584
 					
1585
-					if (!empty($option_values)) {
1586
-						foreach ($option_values as $option_value) {
1587
-							if (empty($option_value['optgroup'])) {
1588
-							?>
1585
+                    if (!empty($option_values)) {
1586
+                        foreach ($option_values as $option_value) {
1587
+                            if (empty($option_value['optgroup'])) {
1588
+                            ?>
1589 1589
 							<input name="<?php echo $name;?>" id="<?php echo $name;?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type;?>" type="radio" /><?php echo $option_value['label']; ?>
1590 1590
 							<?php
1591
-							}
1592
-						}
1593
-					}
1591
+                            }
1592
+                        }
1593
+                    }
1594 1594
                 }
1595 1595
                 ?>
1596 1596
                 <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
@@ -2033,8 +2033,8 @@  discard block
 block discarded – undo
2033 2033
                     $file_totImg = count($curImages);
2034 2034
             }
2035 2035
 			
2036
-			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
2037
-			$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
2036
+            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
2037
+            $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
2038 2038
 
2039 2039
             ?>
2040 2040
             <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
@@ -2062,10 +2062,10 @@  discard block
 block discarded – undo
2062 2062
 					<?php } ?>
2063 2063
                     <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
2064 2064
                            value="<?php if (isset($file_totImg)) {
2065
-                               echo esc_attr($file_totImg);
2066
-                           } else {
2067
-                               echo '0';
2068
-                           } ?>"/>
2065
+                                echo esc_attr($file_totImg);
2066
+                            } else {
2067
+                                echo '0';
2068
+                            } ?>"/>
2069 2069
 
2070 2070
                     <div style="float:left; width:55%;">
2071 2071
                         <div
@@ -2124,18 +2124,18 @@  discard block
 block discarded – undo
2124 2124
 
2125 2125
 
2126 2126
 if (!function_exists('geodir_get_field_infoby')) {
2127
-	/**
2128
-	 * Get custom field using key and value.
2129
-	 *
2130
-	 * @since 1.0.0
2131
-	 * @package GeoDirectory
2127
+    /**
2128
+     * Get custom field using key and value.
2129
+     *
2130
+     * @since 1.0.0
2131
+     * @package GeoDirectory
2132 2132
      * @global object $wpdb WordPress Database object.
2133
-	 * @param string $key The key you want to look for.
2134
-	 * @param string $value The value of the key you want to look for.
2135
-	 * @param string $geodir_post_type The post type.
2136
-	 * @return bool|mixed Returns field info when available. otherwise returns false.
2137
-	 */
2138
-	function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
2133
+     * @param string $key The key you want to look for.
2134
+     * @param string $value The value of the key you want to look for.
2135
+     * @param string $geodir_post_type The post type.
2136
+     * @return bool|mixed Returns field info when available. otherwise returns false.
2137
+     */
2138
+    function geodir_get_field_infoby($key = '', $value = '', $geodir_post_type = '')
2139 2139
     {
2140 2140
 
2141 2141
         global $wpdb;
@@ -2158,21 +2158,21 @@  discard block
 block discarded – undo
2158 2158
 
2159 2159
 
2160 2160
 if (!function_exists('geodir_show_listing_info')) {
2161
-	/**
2162
-	 * Show listing info depending on field location.
2163
-	 *
2164
-	 * @since 1.0.0
2165
-	 * @since 1.5.7 Custom fields option values added to db translation.
2161
+    /**
2162
+     * Show listing info depending on field location.
2163
+     *
2164
+     * @since 1.0.0
2165
+     * @since 1.5.7 Custom fields option values added to db translation.
2166 2166
      *              Changes to display url fields title.
2167
-	 * @package GeoDirectory
2167
+     * @package GeoDirectory
2168 2168
      * @global object $wpdb WordPress Database object.
2169 2169
      * @global object $post The current post object.
2170 2170
      * @global bool $send_to_friend True if send to friend link already rendered. Otherwise false.
2171 2171
      *
2172
-	 * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
2173
-	 * @return string Returns listing info html.
2174
-	 */
2175
-	function geodir_show_listing_info($fields_location = '') {
2172
+     * @param string $fields_location In which page you are going to place this custom fields?. Ex: listing, detail etc.
2173
+     * @return string Returns listing info html.
2174
+     */
2175
+    function geodir_show_listing_info($fields_location = '') {
2176 2176
         global $post, $preview, $wpdb, $send_to_friend;
2177 2177
 
2178 2178
         $payment_info = array();
@@ -2181,7 +2181,7 @@  discard block
 block discarded – undo
2181 2181
         $package_info = geodir_post_package_info($package_info, $post);
2182 2182
         $post_package_id = $package_info->pid;
2183 2183
         $p_type = (geodir_get_current_posttype()) ? geodir_get_current_posttype() : $post->post_type;
2184
-		$send_to_friend = false;
2184
+        $send_to_friend = false;
2185 2185
 
2186 2186
         ob_start();
2187 2187
         $fields_info = geodir_post_custom_fields($post_package_id, 'default', $p_type, $fields_location);
@@ -2195,7 +2195,7 @@  discard block
 block discarded – undo
2195 2195
 
2196 2196
                 $i = 1;
2197 2197
             foreach ($fields_info as $type) {
2198
-				$type = stripslashes_deep($type); // strip slashes
2198
+                $type = stripslashes_deep($type); // strip slashes
2199 2199
                 $html = '';
2200 2200
                 $html_var = '';
2201 2201
                 $field_icon = '';
@@ -2400,13 +2400,13 @@  discard block
 block discarded – undo
2400 2400
                                 $field_icon = '';
2401 2401
                             }
2402 2402
 							
2403
-							$a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2403
+                            $a_url = geodir_parse_custom_field_url($post->{$type['htmlvar_name']});
2404 2404
 
2405 2405
 
2406
-							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2407
-							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2406
+                            $website = !empty($a_url['url']) ? $a_url['url'] : '';
2407
+                            $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2408 2408
                             if(!empty($type['default_value'])){$title = $type['default_value'];}
2409
-							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2409
+                            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2410 2410
 
2411 2411
 
2412 2412
                             $geodir_odd_even = '';
@@ -2624,22 +2624,22 @@  discard block
 block discarded – undo
2624 2624
                         if ($post->{$type['htmlvar_name']} != ''):
2625 2625
 
2626 2626
                             if ($post->{$type['htmlvar_name']} == 'f' || $post->{$type['htmlvar_name']} == '0') {
2627
-								$html_val = __('No', 'geodirectory');
2628
-							} else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2629
-								$html_val = __('Yes', 'geodirectory');
2630
-							} else {								
2631
-								if (!empty($type['option_values'])) {
2632
-									$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2627
+                                $html_val = __('No', 'geodirectory');
2628
+                            } else if ($post->{$type['htmlvar_name']} == 't' || $post->{$type['htmlvar_name']} == '1') {
2629
+                                $html_val = __('Yes', 'geodirectory');
2630
+                            } else {								
2631
+                                if (!empty($type['option_values'])) {
2632
+                                    $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2633 2633
 									
2634
-									if (!empty($cf_option_values)) {
2635
-										foreach ($cf_option_values as $cf_option_value) {
2636
-											if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2637
-												$html_val = $cf_option_value['label'];
2638
-											}
2639
-										}
2640
-									}
2641
-								}
2642
-							}
2634
+                                    if (!empty($cf_option_values)) {
2635
+                                        foreach ($cf_option_values as $cf_option_value) {
2636
+                                            if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->{$type['htmlvar_name']}) {
2637
+                                                $html_val = $cf_option_value['label'];
2638
+                                            }
2639
+                                        }
2640
+                                    }
2641
+                                }
2642
+                            }
2643 2643
 
2644 2644
                             if (strpos($field_icon, 'http') !== false) {
2645 2645
                                 $field_icon_af = '';
@@ -2710,19 +2710,19 @@  discard block
 block discarded – undo
2710 2710
                         $html_var = $type['htmlvar_name'];
2711 2711
 
2712 2712
                         if ($post->{$type['htmlvar_name']}):
2713
-							$field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2713
+                            $field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2714 2714
 							
2715
-							if (!empty($type['option_values'])) {
2716
-								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2715
+                            if (!empty($type['option_values'])) {
2716
+                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2717 2717
 								
2718
-								if (!empty($cf_option_values)) {
2719
-									foreach ($cf_option_values as $cf_option_value) {
2720
-										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2721
-											$field_value = $cf_option_value['label'];
2722
-										}
2723
-									}
2724
-								}
2725
-							}
2718
+                                if (!empty($cf_option_values)) {
2719
+                                    foreach ($cf_option_values as $cf_option_value) {
2720
+                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2721
+                                            $field_value = $cf_option_value['label'];
2722
+                                        }
2723
+                                    }
2724
+                                }
2725
+                            }
2726 2726
 							
2727 2727
                             if (strpos($field_icon, 'http') !== false) {
2728 2728
                                 $field_icon_af = '';
@@ -2770,19 +2770,19 @@  discard block
 block discarded – undo
2770 2770
                                 $field_icon = '';
2771 2771
                             }
2772 2772
 							
2773
-							$field_values = explode(',', trim($post->$type['htmlvar_name'], ","));
2773
+                            $field_values = explode(',', trim($post->$type['htmlvar_name'], ","));
2774 2774
 
2775 2775
                             $option_values = array();
2776
-							if (!empty($type['option_values'])) {
2777
-								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2776
+                            if (!empty($type['option_values'])) {
2777
+                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2778 2778
 								
2779
-								if (!empty($cf_option_values)) {
2780
-									foreach ($cf_option_values as $cf_option_value) {
2781
-										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2782
-											$option_values[] = $cf_option_value['label'];
2783
-										}
2784
-									}
2785
-								}
2779
+                                if (!empty($cf_option_values)) {
2780
+                                    foreach ($cf_option_values as $cf_option_value) {
2781
+                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2782
+                                            $option_values[] = $cf_option_value['label'];
2783
+                                        }
2784
+                                    }
2785
+                                }
2786 2786
                             }
2787 2787
 							
2788 2788
                             $geodir_odd_even = '';
@@ -2802,11 +2802,11 @@  discard block
 block discarded – undo
2802 2802
                             if (count($option_values) > 1) {
2803 2803
                                 $html .= '<ul>';
2804 2804
                                 
2805
-								foreach ($option_values as $val) {
2805
+                                foreach ($option_values as $val) {
2806 2806
                                     $html .= '<li>' . $val . '</li>';
2807 2807
                                 }
2808 2808
                                 
2809
-								$html .= '</ul>';
2809
+                                $html .= '</ul>';
2810 2810
                             } else {
2811 2811
                                 $html .= $post->$type['htmlvar_name'];
2812 2812
                             }
@@ -2815,13 +2815,13 @@  discard block
 block discarded – undo
2815 2815
                         endif;
2816 2816
                         break;
2817 2817
                     case 'email':
2818
-						if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
2819
-							continue; // Remove Send Enquiry | Send To Friend from listings page
2820
-						}
2818
+                        if ($type['htmlvar_name'] == 'geodir_email' && !(geodir_is_page('detail') || geodir_is_page('preview'))) {
2819
+                            continue; // Remove Send Enquiry | Send To Friend from listings page
2820
+                        }
2821 2821
                        
2822
-					    if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) {
2823
-						    $send_to_friend = true;
2824
-							$b_send_inquiry = '';
2822
+                        if ($type['htmlvar_name'] == 'geodir_email' && ((isset($package_info->sendtofriend) && $package_info->sendtofriend) || $post->{$type['htmlvar_name']})) {
2823
+                            $send_to_friend = true;
2824
+                            $b_send_inquiry = '';
2825 2825
                             $b_sendtofriend = '';
2826 2826
 
2827 2827
                             $html = '';
@@ -2859,7 +2859,7 @@  discard block
 block discarded – undo
2859 2859
 
2860 2860
                             if (isset($package_info->sendtofriend) && $package_info->sendtofriend) {
2861 2861
                                 $html .= $seperator . '<a href="javascript:void(0);" class="' . $b_sendtofriend . '">' . SEND_TO_FRIEND . '</a>';
2862
-							}
2862
+                            }
2863 2863
 
2864 2864
                             $html .= '</span></div>';
2865 2865
 
@@ -2932,13 +2932,13 @@  discard block
 block discarded – undo
2932 2932
                             if (!empty($files)):
2933 2933
 
2934 2934
                                $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2935
-							   $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2935
+                                $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2936 2936
 								
2937
-								$file_paths = '';
2937
+                                $file_paths = '';
2938 2938
                                 foreach ($files as $file) {
2939 2939
                                     if (!empty($file)) {
2940 2940
 
2941
-                                       // $filetype = wp_check_filetype($file);
2941
+                                        // $filetype = wp_check_filetype($file);
2942 2942
 
2943 2943
                                         $image_name_arr = explode('/', $file);
2944 2944
                                         $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
@@ -2947,29 +2947,29 @@  discard block
 block discarded – undo
2947 2947
 
2948 2948
                                         $arr_file_type = wp_check_filetype($filename);
2949 2949
                                         if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2950
-											continue;
2951
-										}
2950
+                                            continue;
2951
+                                        }
2952 2952
 										
2953
-										$uploaded_file_type = $arr_file_type['type'];
2954
-										$uploaded_file_ext = $arr_file_type['ext'];
2953
+                                        $uploaded_file_type = $arr_file_type['type'];
2954
+                                        $uploaded_file_ext = $arr_file_type['ext'];
2955 2955
 										
2956
-										if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2957
-											continue; // Invalid file type.
2958
-										}
2956
+                                        if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2957
+                                            continue; // Invalid file type.
2958
+                                        }
2959 2959
 
2960 2960
                                         //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
2961
-										$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2961
+                                        $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2962 2962
 
2963 2963
                                         // If the uploaded file is image
2964 2964
                                         if (in_array($uploaded_file_type, $image_file_types)) {
2965 2965
                                             $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2966 2966
                                             $file_paths .= '<a href="'.$file.'">';
2967
-											$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2968
-											$file_paths .= '</a>';
2967
+                                            $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2968
+                                            $file_paths .= '</a>';
2969 2969
                                             //$file_paths .= '<img src="'.$file.'"  />';	
2970 2970
                                             $file_paths .= '</div>';
2971 2971
                                         } else {
2972
-											$ext_path = '_' . $html_var . '_';
2972
+                                            $ext_path = '_' . $html_var . '_';
2973 2973
                                             $filename = explode($ext_path, $filename);
2974 2974
                                             $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2975 2975
                                         }
@@ -3174,14 +3174,14 @@  discard block
 block discarded – undo
3174 3174
 }
3175 3175
 
3176 3176
 if (!function_exists('geodir_default_date_format')) {
3177
-	/**
3178
-	 * Returns default date format.
3179
-	 *
3180
-	 * @since 1.0.0
3181
-	 * @package GeoDirectory
3182
-	 * @return mixed|string|void Returns default date format.
3183
-	 */
3184
-	function geodir_default_date_format()
3177
+    /**
3178
+     * Returns default date format.
3179
+     *
3180
+     * @since 1.0.0
3181
+     * @package GeoDirectory
3182
+     * @return mixed|string|void Returns default date format.
3183
+     */
3184
+    function geodir_default_date_format()
3185 3185
     {
3186 3186
         if ($format = get_option('date_format'))
3187 3187
             return $format;
@@ -3191,30 +3191,30 @@  discard block
 block discarded – undo
3191 3191
 }
3192 3192
 
3193 3193
 if (!function_exists('geodir_get_formated_date')) {
3194
-	/**
3195
-	 * Returns formatted date.
3196
-	 *
3197
-	 * @since 1.0.0
3198
-	 * @package GeoDirectory
3199
-	 * @param string $date Date string to convert.
3200
-	 * @return bool|int|string Returns formatted date.
3201
-	 */
3202
-	function geodir_get_formated_date($date)
3194
+    /**
3195
+     * Returns formatted date.
3196
+     *
3197
+     * @since 1.0.0
3198
+     * @package GeoDirectory
3199
+     * @param string $date Date string to convert.
3200
+     * @return bool|int|string Returns formatted date.
3201
+     */
3202
+    function geodir_get_formated_date($date)
3203 3203
     {
3204 3204
         return mysql2date(get_option('date_format'), $date);
3205 3205
     }
3206 3206
 }
3207 3207
 
3208 3208
 if (!function_exists('geodir_get_formated_time')) {
3209
-	/**
3210
-	 * Returns formatted time.
3211
-	 *
3212
-	 * @since 1.0.0
3213
-	 * @package GeoDirectory
3214
-	 * @param string $time Time string to convert.
3215
-	 * @return bool|int|string Returns formatted time.
3216
-	 */
3217
-	function geodir_get_formated_time($time)
3209
+    /**
3210
+     * Returns formatted time.
3211
+     *
3212
+     * @since 1.0.0
3213
+     * @package GeoDirectory
3214
+     * @param string $time Time string to convert.
3215
+     * @return bool|int|string Returns formatted time.
3216
+     */
3217
+    function geodir_get_formated_time($time)
3218 3218
     {
3219 3219
         return mysql2date(get_option('time_format'), $time, $translate = true);
3220 3220
     }
@@ -3222,21 +3222,21 @@  discard block
 block discarded – undo
3222 3222
 
3223 3223
 
3224 3224
 if (!function_exists('geodir_save_post_file_fields')) {
3225
-	/**
3226
-	 * Save post file fields
3227
-	 *
3228
-	 * @since 1.0.0
3229
-	 * @since 1.4.7 Added `$extra_fields` parameter.
3230
-	 * @package GeoDirectory
3225
+    /**
3226
+     * Save post file fields
3227
+     *
3228
+     * @since 1.0.0
3229
+     * @since 1.4.7 Added `$extra_fields` parameter.
3230
+     * @package GeoDirectory
3231 3231
      * @global object $wpdb WordPress Database object.
3232 3232
      * @global string $plugin_prefix Geodirectory plugin table prefix.
3233 3233
      * @global object $current_user Current user object.
3234
-	 * @param int $post_id
3235
-	 * @param string $field_id
3236
-	 * @param array $post_image
3237
-	 * @param array $extra_fields Array of extra fields.
3238
-	 */
3239
-	function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
3234
+     * @param int $post_id
3235
+     * @param string $field_id
3236
+     * @param array $post_image
3237
+     * @param array $extra_fields Array of extra fields.
3238
+     */
3239
+    function geodir_save_post_file_fields($post_id = 0, $field_id = '', $post_image = array(), $extra_fields = array())
3240 3240
     {
3241 3241
 
3242 3242
         global $wpdb, $plugin_prefix, $current_user;
@@ -3262,7 +3262,7 @@  discard block
 block discarded – undo
3262 3262
             $geodir_uploadurl = $uploads['url'];
3263 3263
             $sub_dir = $uploads['subdir'];
3264 3264
 			
3265
-			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
3265
+            $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
3266 3266
 
3267 3267
             for ($m = 0; $m < count($post_image); $m++) {
3268 3268
 
@@ -3279,47 +3279,47 @@  discard block
 block discarded – undo
3279 3279
 
3280 3280
                     $arr_file_type = wp_check_filetype($filename);
3281 3281
 					
3282
-					if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
3283
-						continue;
3284
-					}
3282
+                    if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
3283
+                        continue;
3284
+                    }
3285 3285
 					
3286
-					$uploaded_file_type = $arr_file_type['type'];
3287
-					$uploaded_file_ext = $arr_file_type['ext'];
3286
+                    $uploaded_file_type = $arr_file_type['type'];
3287
+                    $uploaded_file_ext = $arr_file_type['ext'];
3288 3288
 					
3289
-					if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
3290
-						continue; // Invalid file type.
3291
-					}
3289
+                    if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
3290
+                        continue; // Invalid file type.
3291
+                    }
3292 3292
 
3293 3293
                     // Set an array containing a list of acceptable formats
3294 3294
                     //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
3295 3295
 
3296
-					if (!function_exists('wp_handle_upload'))
3297
-						require_once(ABSPATH . 'wp-admin/includes/file.php');
3296
+                    if (!function_exists('wp_handle_upload'))
3297
+                        require_once(ABSPATH . 'wp-admin/includes/file.php');
3298 3298
 
3299
-					if (!is_dir($geodir_uploadpath))
3300
-						mkdir($geodir_uploadpath);
3299
+                    if (!is_dir($geodir_uploadpath))
3300
+                        mkdir($geodir_uploadpath);
3301 3301
 
3302
-					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
3303
-					$explode_sub_dir = explode("/", $sub_dir);
3304
-					if ($curr_img_dir == end($explode_sub_dir)) {
3305
-						$img_path = $geodir_uploadpath . '/' . $filename;
3306
-						$img_url = $geodir_uploadurl . '/' . $filename;
3307
-					} else {
3308
-						$img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
3309
-						$img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
3310
-					}
3302
+                    $new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
3303
+                    $explode_sub_dir = explode("/", $sub_dir);
3304
+                    if ($curr_img_dir == end($explode_sub_dir)) {
3305
+                        $img_path = $geodir_uploadpath . '/' . $filename;
3306
+                        $img_url = $geodir_uploadurl . '/' . $filename;
3307
+                    } else {
3308
+                        $img_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $filename;
3309
+                        $img_url = $uploads['url'] . '/temp_' . $current_user->data->ID . '/' . $filename;
3310
+                    }
3311 3311
 
3312
-					$uploaded_file = '';
3313
-					if (file_exists($img_path))
3314
-						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3312
+                    $uploaded_file = '';
3313
+                    if (file_exists($img_path))
3314
+                        $uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3315 3315
 
3316
-					if ($curr_img_dir != $geodir_uploaddir) {
3317
-						if (file_exists($img_path))
3318
-							unlink($img_path);
3319
-					}
3316
+                    if ($curr_img_dir != $geodir_uploaddir) {
3317
+                        if (file_exists($img_path))
3318
+                            unlink($img_path);
3319
+                    }
3320 3320
 
3321
-					if (!empty($uploaded_file))
3322
-						$file_urls = $geodir_uploadurl . '/' . $new_name;
3321
+                    if (!empty($uploaded_file))
3322
+                        $file_urls = $geodir_uploadurl . '/' . $new_name;
3323 3323
 
3324 3324
                 } else {
3325 3325
                     $file_urls = $post_image[$m];
@@ -3374,16 +3374,16 @@  discard block
 block discarded – undo
3374 3374
 
3375 3375
 if (!function_exists('geodir_plupload_action')) {
3376 3376
 
3377
-	/**
3378
-	 * Get upload directory path details
3379
-	 *
3380
-	 * @since 1.0.0
3381
-	 * @package GeoDirectory
3377
+    /**
3378
+     * Get upload directory path details
3379
+     *
3380
+     * @since 1.0.0
3381
+     * @package GeoDirectory
3382 3382
      * @global object $current_user Current user object.
3383
-	 * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
3384
-	 * @return mixed Returns upload directory details as an array.
3385
-	 */
3386
-	function geodir_upload_dir($upload)
3383
+     * @param array $upload Array of upload directory data with keys of 'path','url', 'subdir, 'basedir', and 'error'.
3384
+     * @return mixed Returns upload directory details as an array.
3385
+     */
3386
+    function geodir_upload_dir($upload)
3387 3387
     {
3388 3388
         global $current_user;
3389 3389
         $upload['subdir'] = $upload['subdir'] . '/temp_' . $current_user->data->ID;
@@ -3483,14 +3483,14 @@  discard block
 block discarded – undo
3483 3483
 }
3484 3484
 
3485 3485
 if (!function_exists('geodir_max_upload_size')) {
3486
-	/**
3487
-	 * Get max upload file size
3488
-	 *
3489
-	 * @since 1.0.0
3490
-	 * @package GeoDirectory
3491
-	 * @return mixed|void Returns max upload file size.
3492
-	 */
3493
-	function geodir_max_upload_size()
3486
+    /**
3487
+     * Get max upload file size
3488
+     *
3489
+     * @since 1.0.0
3490
+     * @package GeoDirectory
3491
+     * @return mixed|void Returns max upload file size.
3492
+     */
3493
+    function geodir_max_upload_size()
3494 3494
     {
3495 3495
         $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
3496 3496
 
@@ -3663,14 +3663,14 @@  discard block
 block discarded – undo
3663 3663
 
3664 3664
 
3665 3665
 if (!function_exists('geodir_custom_sort_field_save')) {
3666
-	/**
3667
-	 * Save or Update custom sort fields into the database.
3668
-	 *
3669
-	 * @since 1.0.0
3670
-	 * @package GeoDirectory
3666
+    /**
3667
+     * Save or Update custom sort fields into the database.
3668
+     *
3669
+     * @since 1.0.0
3670
+     * @package GeoDirectory
3671 3671
      * @global object $wpdb WordPress Database object.
3672 3672
      * @global string $plugin_prefix Geodirectory plugin table prefix.
3673
-	 * @param array $request_field {
3673
+     * @param array $request_field {
3674 3674
      *    Attributes of the Request field.
3675 3675
      *
3676 3676
      *    @type string $action Ajax action name.
@@ -3689,10 +3689,10 @@  discard block
 block discarded – undo
3689 3689
      *    @type string $sort_order Sort Order.
3690 3690
      *
3691 3691
      * }
3692
-	 * @param bool $default Not yet implemented.
3693
-	 * @return int Returns the last affected db table row id.
3694
-	 */
3695
-	function geodir_custom_sort_field_save($request_field = array(), $default = false)
3692
+     * @param bool $default Not yet implemented.
3693
+     * @return int Returns the last affected db table row id.
3694
+     */
3695
+    function geodir_custom_sort_field_save($request_field = array(), $default = false)
3696 3696
     {
3697 3697
 
3698 3698
         global $wpdb, $plugin_prefix;
@@ -3810,16 +3810,16 @@  discard block
 block discarded – undo
3810 3810
 
3811 3811
 
3812 3812
 if (!function_exists('geodir_custom_sort_field_delete')) {
3813
-	/**
3814
-	 * Delete a custom sort field using field id.
3815
-	 * @since 1.0.0
3816
-	 * @package GeoDirectory
3813
+    /**
3814
+     * Delete a custom sort field using field id.
3815
+     * @since 1.0.0
3816
+     * @package GeoDirectory
3817 3817
      * @global object $wpdb WordPress Database object.
3818 3818
      * @global string $plugin_prefix Geodirectory plugin table prefix.
3819
-	 * @param string $field_id The field ID.
3820
-	 * @return int|string Returns field id when successful deletion, else returns 0.
3821
-	 */
3822
-	function geodir_custom_sort_field_delete($field_id = '')
3819
+     * @param string $field_id The field ID.
3820
+     * @return int|string Returns field id when successful deletion, else returns 0.
3821
+     */
3822
+    function geodir_custom_sort_field_delete($field_id = '')
3823 3823
     {
3824 3824
 
3825 3825
         global $wpdb, $plugin_prefix;
@@ -3838,18 +3838,18 @@  discard block
 block discarded – undo
3838 3838
 
3839 3839
 
3840 3840
 if (!function_exists('geodir_custom_sort_field_adminhtml')) {
3841
-	/**
3842
-	 * Custom sort field admin html.
3843
-	 *
3844
-	 * @since 1.0.0
3845
-	 * @package GeoDirectory
3841
+    /**
3842
+     * Custom sort field admin html.
3843
+     *
3844
+     * @since 1.0.0
3845
+     * @package GeoDirectory
3846 3846
      * @global object $wpdb WordPress Database object.
3847
-	 * @param string $field_type The form field type.
3848
-	 * @param object|int $result_str The custom field results object or row id.
3849
-	 * @param string $field_ins_upd When set to "submit" displays form.
3850
-	 * @param bool $default when set to true field will be for admin use only.
3851
-	 */
3852
-	function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
3847
+     * @param string $field_type The form field type.
3848
+     * @param object|int $result_str The custom field results object or row id.
3849
+     * @param string $field_ins_upd When set to "submit" displays form.
3850
+     * @param bool $default when set to true field will be for admin use only.
3851
+     */
3852
+    function geodir_custom_sort_field_adminhtml($field_type, $result_str, $field_ins_upd = '', $default = false)
3853 3853
     {
3854 3854
         global $wpdb;
3855 3855
         $cf = $result_str;
@@ -3914,10 +3914,10 @@  discard block
 block discarded – undo
3914 3914
 
3915 3915
             <div id="field_frm<?php echo $result_str;?>" class="field_frm"
3916 3916
                  style="display:<?php if ($field_ins_upd == 'submit') {
3917
-                     echo 'block;';
3918
-                 } else {
3919
-                     echo 'none;';
3920
-                 } ?>">
3917
+                        echo 'block;';
3918
+                    } else {
3919
+                        echo 'none;';
3920
+                    } ?>">
3921 3921
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
3922 3922
                 <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
3923 3923
                 <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
@@ -3945,8 +3945,8 @@  discard block
 block discarded – undo
3945 3945
                                 <input type="text" name="asc_title" id="asc_title"
3946 3946
                                        placeholder="<?php esc_attr_e('Ascending title', 'geodirectory'); ?>"
3947 3947
                                        value="<?php if (isset($field_info->asc_title)) {
3948
-                                           echo esc_attr($field_info->asc_title);
3949
-                                       } ?>" style="width:45%;"/>
3948
+                                            echo esc_attr($field_info->asc_title);
3949
+                                        } ?>" style="width:45%;"/>
3950 3950
 
3951 3951
                                 <input type="radio" name="is_default"
3952 3952
                                        value="<?php echo $htmlvar_name; ?>_asc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_asc') {
@@ -3969,8 +3969,8 @@  discard block
 block discarded – undo
3969 3969
                                 <input type="text" name="desc_title" id="desc_title"
3970 3970
                                        placeholder="<?php esc_attr_e('Descending title', 'geodirectory'); ?>"
3971 3971
                                        value="<?php if (isset($field_info->desc_title)) {
3972
-                                           echo esc_attr($field_info->desc_title);
3973
-                                       } ?>" style="width:45%;"/>
3972
+                                            echo esc_attr($field_info->desc_title);
3973
+                                        } ?>" style="width:45%;"/>
3974 3974
                                 <input type="radio" name="is_default"
3975 3975
                                        value="<?php echo $htmlvar_name; ?>_desc" <?php if (isset($field_info->default_order) && $field_info->default_order == $htmlvar_name . '_desc') {
3976 3976
                                     echo 'checked="checked"';
@@ -4056,19 +4056,19 @@  discard block
 block discarded – undo
4056 4056
 }
4057 4057
 
4058 4058
 if (!function_exists('check_field_visibility')) {
4059
-	/**
4060
-	 * Check field visibility as per price package.
4061
-	 *
4062
-	 * @since 1.0.0
4063
-	 * @package GeoDirectory
4059
+    /**
4060
+     * Check field visibility as per price package.
4061
+     *
4062
+     * @since 1.0.0
4063
+     * @package GeoDirectory
4064 4064
      * @global object $wpdb WordPress Database object.
4065 4065
      * @global array $geodir_addon_list List of active GeoDirectory extensions.
4066
-	 * @param int|string $package_id The package ID.
4067
-	 * @param string $field_name The field name.
4068
-	 * @param string $post_type Optional. The wordpress post type.
4069
-	 * @return bool Returns true when field visible, otherwise false.
4070
-	 */
4071
-	function check_field_visibility($package_id, $field_name, $post_type)
4066
+     * @param int|string $package_id The package ID.
4067
+     * @param string $field_name The field name.
4068
+     * @param string $post_type Optional. The wordpress post type.
4069
+     * @return bool Returns true when field visible, otherwise false.
4070
+     */
4071
+    function check_field_visibility($package_id, $field_name, $post_type)
4072 4072
     {
4073 4073
         global $wpdb, $geodir_addon_list;
4074 4074
         if (!(isset($geodir_addon_list['geodir_payment_manager']) && $geodir_addon_list['geodir_payment_manager'] == 'yes')) {
@@ -4116,15 +4116,15 @@  discard block
 block discarded – undo
4116 4116
                 $input_str = explode("/", $input_str, 2);
4117 4117
                 $label = trim($input_str[0]);
4118 4118
                 if ($translated && $label != '') {
4119
-					$label = __($label, 'geodirectory');
4120
-				}
4121
-				$label = ucfirst($label);
4119
+                    $label = __($label, 'geodirectory');
4120
+                }
4121
+                $label = ucfirst($label);
4122 4122
                 $value = trim($input_str[1]);
4123 4123
             } else {
4124 4124
                 if ($translated && $input_str != '') {
4125
-					$input_str = __($input_str, 'geodirectory');
4126
-				}
4127
-				$label = ucfirst($input_str);
4125
+                    $input_str = __($input_str, 'geodirectory');
4126
+                }
4127
+                $label = ucfirst($input_str);
4128 4128
                 $value = $input_str;
4129 4129
             }
4130 4130
 
@@ -4170,9 +4170,9 @@  discard block
 block discarded – undo
4170 4170
                     if (strpos($optgroup_str, "|") !== false) {
4171 4171
                         $optgroup_str_arr = explode("|", $optgroup_str, 2);
4172 4172
                         $optgroup_label = trim($optgroup_str_arr[0]);
4173
-						if ($translated && $optgroup_label != '') {
4174
-							$optgroup_label = __($optgroup_label, 'geodirectory');
4175
-						}
4173
+                        if ($translated && $optgroup_label != '') {
4174
+                            $optgroup_label = __($optgroup_label, 'geodirectory');
4175
+                        }
4176 4176
                         $optgroup_label = ucfirst($optgroup_label);
4177 4177
                         $optgroup_str = $optgroup_str_arr[1];
4178 4178
                     }
Please login to merge, or discard this patch.
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	function geodir_add_column_if_not_exist($db, $column, $column_attr = "VARCHAR( 255 ) NOT NULL")
50 50
     {
51 51
         global $wpdb;
52
-        $result = 0;// no rows affected
52
+        $result = 0; // no rows affected
53 53
         if (!geodir_column_exist($db, $column)) {
54 54
             if (!empty($db) && !empty($column))
55 55
                 $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 
428 428
                 $last_order = $wpdb->get_var("SELECT MAX(sort_order) as last_order FROM " . GEODIR_CUSTOM_FIELDS_TABLE);
429 429
 
430
-                $sort_order = (int)$last_order + 1;
430
+                $sort_order = (int) $last_order + 1;
431 431
             }
432 432
 
433 433
             $default_value_add = '';
@@ -679,18 +679,18 @@  discard block
 block discarded – undo
679 679
                     $op_size = '500';
680 680
 
681 681
                     // only make the field as big as it needs to be.
682
-                    if(isset($option_values) && $option_values && $field_type=='select'){
683
-                        $option_values_arr = explode(',',$option_values);
684
-                        if(is_array($option_values_arr)){
682
+                    if (isset($option_values) && $option_values && $field_type == 'select') {
683
+                        $option_values_arr = explode(',', $option_values);
684
+                        if (is_array($option_values_arr)) {
685 685
                             $op_max = 0;
686
-                            foreach($option_values_arr as $op_val){
687
-                                if(strlen($op_val) && strlen($op_val)>$op_max){$op_max = strlen($op_val);}
686
+                            foreach ($option_values_arr as $op_val) {
687
+                                if (strlen($op_val) && strlen($op_val) > $op_max) {$op_max = strlen($op_val); }
688 688
                             }
689
-                            if($op_max){$op_size =$op_max; }
689
+                            if ($op_max) {$op_size = $op_max; }
690 690
                         }
691
-                    }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
692
-                        if(strlen($option_values)){
693
-                            $op_size =  strlen($option_values);
691
+                    }elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
692
+                        if (strlen($option_values)) {
693
+                            $op_size = strlen($option_values);
694 694
                         }
695 695
                     }
696 696
 
@@ -701,8 +701,8 @@  discard block
 block discarded – undo
701 701
                         }
702 702
 
703 703
                     $alter_result = $wpdb->query($meta_field_add);
704
-                    if($alter_result===false){
705
-                        return __('Column change failed, you may have too many columns.','geodirectory');
704
+                    if ($alter_result === false) {
705
+                        return __('Column change failed, you may have too many columns.', 'geodirectory');
706 706
                     }
707 707
 
708 708
                         if (isset($request_field['cat_display_type']))
@@ -718,8 +718,8 @@  discard block
 block discarded – undo
718 718
                     case 'html':
719 719
 
720 720
                     $alter_result = $wpdb->query("ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` TEXT NULL");
721
-                    if($alter_result===false){
722
-                        return __('Column change failed, you may have too many columns.','geodirectory');
721
+                    if ($alter_result === false) {
722
+                        return __('Column change failed, you may have too many columns.', 'geodirectory');
723 723
                     }
724 724
                         if (isset($request_field['advanced_editor']))
725 725
                             $extra_fields = $request_field['advanced_editor'];
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
                     default:
734 734
                         if ($data_type != 'VARCHAR' && $data_type != '') {
735 735
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
736
-                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int)$decimal_point . ") NULL";
736
+                                $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` DECIMAL(11, " . (int) $decimal_point . ") NULL";
737 737
                             } else {
738 738
                                 $default_value_add = "ALTER TABLE " . $detail_table . " CHANGE `" . $old_html_variable . "` `" . $htmlvar_name . "` " . $data_type . " NULL";
739 739
                             }
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
                         }
750 750
 
751 751
                         $alter_result = $wpdb->query($default_value_add);
752
-                        if($alter_result===false){
753
-                            return __('Column change failed, you may have too many columns.','geodirectory');
752
+                        if ($alter_result === false) {
753
+                            return __('Column change failed, you may have too many columns.', 'geodirectory');
754 754
                         }
755 755
                         break;
756 756
                 endswitch;
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 					for_admin_use = %s
799 799
 					where id = %d",
800 800
 
801
-                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use, $cf)
801
+                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_required, $required_msg, $css_class, $field_icon, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use, $cf)
802 802
                     )
803 803
 
804 804
                 );
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
                         $data_type = 'TINYINT';
959 959
 
960 960
                         $meta_field_add = $data_type . "( 1 ) NOT NULL ";
961
-                        if ((int)$default_value === 1) {
961
+                        if ((int) $default_value === 1) {
962 962
                             $meta_field_add .= " DEFAULT '1'";
963 963
                         }
964 964
 
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
                             }
992 992
                         } elseif (isset($option_values) && $option_values && $field_type == 'multiselect') {
993 993
                             if (strlen($option_values)) {
994
-                                $op_size =  strlen($option_values);
994
+                                $op_size = strlen($option_values);
995 995
                             }
996 996
 							
997 997
 							if (isset($request_field['multi_display_type'])) {
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
                             $meta_field_add = $data_type . " NULL ";
1065 1065
 
1066 1066
                             if ($data_type == 'FLOAT' && $decimal_point > 0) {
1067
-                                $meta_field_add = "DECIMAL(11, " . (int)$decimal_point . ") NULL ";
1067
+                                $meta_field_add = "DECIMAL(11, " . (int) $decimal_point . ") NULL ";
1068 1068
                             }
1069 1069
 
1070 1070
                             if (is_numeric($default_value) && $default_value != '') {
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
 					validation_msg = %s,
1130 1130
 					for_admin_use = %s ",
1131 1131
 
1132
-                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point,$validation_pattern,$validation_msg, $for_admin_use)
1132
+                        array($post_type, $admin_title, $site_title, $field_type, $htmlvar_name, $admin_desc, $clabels, $default_value, $sort_order, $is_active, $is_default, $is_admin, $is_required, $required_msg, $css_class, $field_icon, $show_on_listing, $show_on_detail, $show_as_tab, $option_values, $price_pkg, $cat_sort, $cat_filter, $data_type, $extra_field_query, $decimal_point, $validation_pattern, $validation_msg, $for_admin_use)
1133 1133
 
1134 1134
                     )
1135 1135
 
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 
1142 1142
             }
1143 1143
 
1144
-            return (int)$lastid;
1144
+            return (int) $lastid;
1145 1145
 
1146 1146
 
1147 1147
         } else {
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
         $value = '';
1231 1231
 
1232 1232
         /* field available to site admin only for edit */
1233
-        $for_admin_use = isset($val['for_admin_use']) && (int)$val['for_admin_use'] == 1 ? true : false;
1233
+        $for_admin_use = isset($val['for_admin_use']) && (int) $val['for_admin_use'] == 1 ? true : false;
1234 1234
         if ($for_admin_use && !is_super_admin()) {
1235 1235
             continue;
1236 1236
         }
@@ -1267,11 +1267,11 @@  discard block
 block discarded – undo
1267 1267
         do_action('geodir_before_custom_form_field_' . $name, $listing_type, $package_id, $val);
1268 1268
 
1269 1269
         if ($type == 'fieldset') {
1270
-            $fieldset_id = (int)$val['id'];
1270
+            $fieldset_id = (int) $val['id'];
1271 1271
             $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;
1272 1272
             ?>
1273
-            <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>
1274
-            <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5>
1273
+            <h5 id="geodir_fieldset_<?php echo $fieldset_id; ?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id; ?>"><?php echo $site_title; ?>
1274
+            <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>'; ?></h5>
1275 1275
             <?php
1276 1276
         } else if ($type == 'address') {
1277 1277
             $prefix = $name . '_';
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
                 $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1298 1298
                 $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1299 1299
             } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1300
-                $post_info = (array)$post_info;
1300
+                $post_info = (array) $post_info;
1301 1301
 
1302 1302
                 $address = $post_info[$prefix . 'address'];
1303 1303
                 $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
@@ -1341,16 +1341,16 @@  discard block
 block discarded – undo
1341 1341
 
1342 1342
             ?>
1343 1343
 
1344
-            <div id="geodir_<?php echo $prefix . 'address';?>_row"
1345
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1344
+            <div id="geodir_<?php echo $prefix . 'address'; ?>_row"
1345
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1346 1346
                 <label>
1347 1347
                     <?php _e($address_title, 'geodirectory'); ?>
1348
-                    <?php if ($is_required) echo '<span>*</span>';?>
1348
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1349 1349
                 </label>
1350
-                <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1351
-                       id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
1350
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'address'; ?>"
1351
+                       id="<?php echo $prefix . 'address'; ?>" class="geodir_textfield"
1352 1352
                        value="<?php echo esc_attr(stripslashes($address)); ?>"/>
1353
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1353
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1354 1354
                 <?php if ($is_required) { ?>
1355 1355
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1356 1356
                 <?php } ?>
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
             if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1372 1372
 
1373 1373
                 <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1374
-                     class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1374
+                     class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1375 1375
                     <label>
1376 1376
                         <?php _e($zip_title, 'geodirectory'); ?>
1377 1377
                         <?php /*if($is_required) echo '<span>*</span>';*/ ?>
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
 
1388 1388
             <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?>
1389 1389
 
1390
-                <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1390
+                <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1391 1391
                     <?php
1392 1392
                     /**
1393 1393
                      * Contains add listing page map functions.
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
                 /* show lat lng */
1407 1407
                 $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1408 1408
                 <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1409
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1409
+                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>" <?php echo $style_latlng; ?>>
1410 1410
                     <label>
1411 1411
                         <?php echo PLACE_ADDRESS_LAT; ?>
1412 1412
                         <?php if ($is_required) echo '<span>*</span>'; ?>
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
                 </div>
1422 1422
 
1423 1423
                 <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1424
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1424
+                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>" <?php echo $style_latlng; ?>>
1425 1425
                     <label>
1426 1426
                         <?php echo PLACE_ADDRESS_LNG; ?>
1427 1427
                         <?php if ($is_required) echo '<span>*</span>'; ?>
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
             <?php } ?>
1438 1438
 
1439 1439
             <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?>
1440
-                <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1440
+                <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1441 1441
                     <label><?php _e($mapview_title, 'geodirectory'); ?></label>
1442 1442
 
1443 1443
 
@@ -1479,30 +1479,30 @@  discard block
 block discarded – undo
1479 1479
         <?php } elseif ($type == 'text') {
1480 1480
 
1481 1481
             //number and float validation $validation_pattern
1482
-            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
1483
-            elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1482
+            if (isset($val['data_type']) && $val['data_type'] == 'INT') {$type = 'number'; }
1483
+            elseif (isset($val['data_type']) && $val['data_type'] == 'FLOAT') {$type = 'float'; }
1484 1484
             //print_r($val);
1485 1485
             //validation
1486
-            if(isset($val['validation_pattern']) && $val['validation_pattern']){
1487
-                $validation = 'pattern="'.$val['validation_pattern'].'"';
1488
-            }else{$validation='';}
1486
+            if (isset($val['validation_pattern']) && $val['validation_pattern']) {
1487
+                $validation = 'pattern="' . $val['validation_pattern'] . '"';
1488
+            } else {$validation = ''; }
1489 1489
 
1490 1490
             // validation message
1491
-            if(isset($val['validation_msg']) && $val['validation_msg']){
1492
-                $validation_msg = 'title="'.$val['validation_msg'].'"';
1493
-            }else{$validation_msg='';}
1491
+            if (isset($val['validation_msg']) && $val['validation_msg']) {
1492
+                $validation_msg = 'title="' . $val['validation_msg'] . '"';
1493
+            } else {$validation_msg = ''; }
1494 1494
             ?>
1495 1495
 
1496
-            <div id="<?php echo $name;?>_row"
1497
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1496
+            <div id="<?php echo $name; ?>_row"
1497
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1498 1498
                 <label>
1499 1499
                     <?php $site_title = __($site_title, 'geodirectory');
1500 1500
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1501
-                    <?php if ($is_required) echo '<span>*</span>';?>
1501
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1502 1502
                 </label>
1503
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1504
-                       value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
1505
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1503
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1504
+                       value="<?php echo esc_attr(stripslashes($value)); ?>" type="<?php echo $type; ?>" class="geodir_textfield" <?php echo $validation; echo $validation_msg; ?> />
1505
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1506 1506
                 <?php if ($is_required) { ?>
1507 1507
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1508 1508
                 <?php } ?>
@@ -1513,16 +1513,16 @@  discard block
 block discarded – undo
1513 1513
                 $value = '';
1514 1514
             }?>
1515 1515
 
1516
-            <div id="<?php echo $name;?>_row"
1517
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1516
+            <div id="<?php echo $name; ?>_row"
1517
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1518 1518
                 <label>
1519 1519
                     <?php $site_title = __($site_title, 'geodirectory');
1520 1520
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1521
-                    <?php if ($is_required) echo '<span>*</span>';?>
1521
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1522 1522
                 </label>
1523
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1524
-                       value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
1525
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1523
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1524
+                       value="<?php echo esc_attr(stripslashes($value)); ?>" type="email" class="geodir_textfield"/>
1525
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1526 1526
                 <?php if ($is_required) { ?>
1527 1527
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1528 1528
                 <?php } ?>
@@ -1533,16 +1533,16 @@  discard block
 block discarded – undo
1533 1533
                 $value = '';
1534 1534
             } ?>
1535 1535
 
1536
-            <div id="<?php echo $name;?>_row"
1537
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1536
+            <div id="<?php echo $name; ?>_row"
1537
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1538 1538
                 <label>
1539 1539
                     <?php $site_title = __($site_title, 'geodirectory');
1540 1540
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1541
-                    <?php if ($is_required) echo '<span>*</span>';?>
1541
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1542 1542
                 </label>
1543
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1544
-                       value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
1545
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1543
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1544
+                       value="<?php echo esc_attr(stripslashes($value)); ?>" type="tel" class="geodir_textfield"/>
1545
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1546 1546
                 <?php if ($is_required) { ?>
1547 1547
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1548 1548
                 <?php } ?>
@@ -1553,31 +1553,31 @@  discard block
 block discarded – undo
1553 1553
                 $value = '';
1554 1554
             }?>
1555 1555
 
1556
-            <div id="<?php echo $name;?>_row"
1557
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1556
+            <div id="<?php echo $name; ?>_row"
1557
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1558 1558
                 <label>
1559 1559
                     <?php $site_title = __($site_title, 'geodirectory');
1560 1560
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1561
-                    <?php if ($is_required) echo '<span>*</span>';?>
1561
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1562 1562
                 </label>
1563
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1564
-                       value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
1563
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1564
+                       value="<?php echo esc_attr(stripslashes($value)); ?>" type="url" class="geodir_textfield"
1565 1565
                        oninvalid="setCustomValidity('<?php _e('Please enter a valid URL including http://', 'geodirectory'); ?>')"
1566 1566
                        onchange="try{setCustomValidity('')}catch(e){}"
1567 1567
                     />
1568
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1568
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1569 1569
                 <?php if ($is_required) { ?>
1570 1570
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1571 1571
                 <?php } ?>
1572 1572
             </div>
1573 1573
 
1574 1574
         <?php } elseif ($type == 'radio') { ?>
1575
-            <div id="<?php echo $name;?>_row"
1576
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1575
+            <div id="<?php echo $name; ?>_row"
1576
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1577 1577
                 <label>
1578 1578
                     <?php $site_title = __($site_title, 'geodirectory');
1579 1579
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1580
-                    <?php if ($is_required) echo '<span>*</span>';?>
1580
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1581 1581
                 </label>
1582 1582
 				<?php if ($option_values) {
1583 1583
                     $option_values = geodir_string_values_to_options($option_values, true);
@@ -1586,14 +1586,14 @@  discard block
 block discarded – undo
1586 1586
 						foreach ($option_values as $option_value) {
1587 1587
 							if (empty($option_value['optgroup'])) {
1588 1588
 							?>
1589
-							<input name="<?php echo $name;?>" id="<?php echo $name;?>" <?php checked($value, $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type;?>" type="radio" /><?php echo $option_value['label']; ?>
1589
+							<input name="<?php echo $name; ?>" id="<?php echo $name; ?>" <?php checked($value, $option_value['value']); ?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $type; ?>" type="radio" /><?php echo $option_value['label']; ?>
1590 1590
 							<?php
1591 1591
 							}
1592 1592
 						}
1593 1593
 					}
1594 1594
                 }
1595 1595
                 ?>
1596
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1596
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1597 1597
                 <?php if ($is_required) { ?>
1598 1598
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1599 1599
                 <?php } ?>
@@ -1601,22 +1601,22 @@  discard block
 block discarded – undo
1601 1601
 
1602 1602
         <?php } elseif ($type == 'checkbox') { ?>
1603 1603
 
1604
-            <div id="<?php echo $name;?>_row"
1605
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1604
+            <div id="<?php echo $name; ?>_row"
1605
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1606 1606
                 <label>
1607 1607
                     <?php $site_title = __($site_title, 'geodirectory');
1608 1608
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1609
-                    <?php if ($is_required) echo '<span>*</span>';?>
1609
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1610 1610
                 </label>
1611 1611
                 <?php if ($value != '1') {
1612 1612
                     $value = '0';
1613 1613
                 }?>
1614
-                <input type="hidden" name="<?php echo $name;?>" id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>"/>
1614
+                <input type="hidden" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>"/>
1615 1615
                 <input  <?php if ($value == '1') {
1616 1616
                     echo 'checked="checked"';
1617
-                }?>  value="1" class="gd-checkbox" field_type="<?php echo $type;?>" type="checkbox"
1618
-                     onchange="if(this.checked){jQuery('#<?php echo $name;?>').val('1');} else{ jQuery('#<?php echo $name;?>').val('0');}"/>
1619
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1617
+                }?>  value="1" class="gd-checkbox" field_type="<?php echo $type; ?>" type="checkbox"
1618
+                     onchange="if(this.checked){jQuery('#<?php echo $name; ?>').val('1');} else{ jQuery('#<?php echo $name; ?>').val('0');}"/>
1619
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1620 1620
                 <?php if ($is_required) { ?>
1621 1621
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1622 1622
                 <?php } ?>
@@ -1625,44 +1625,44 @@  discard block
 block discarded – undo
1625 1625
         <?php } elseif ($type == 'textarea') {
1626 1626
             ?>
1627 1627
 
1628
-            <div id="<?php echo $name;?>_row"
1629
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1628
+            <div id="<?php echo $name; ?>_row"
1629
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1630 1630
                 <label>
1631 1631
                     <?php $site_title = __($site_title, 'geodirectory');
1632 1632
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1633
-                    <?php if ($is_required) echo '<span>*</span>';?>
1633
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1634 1634
                 </label><?php
1635 1635
 
1636 1636
 
1637 1637
                 if (is_array($extra_fields) && in_array('1', $extra_fields)) {
1638 1638
 
1639
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
1639
+                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
1640 1640
 
1641
-                <div class="editor" field_id="<?php echo $name;?>" field_type="editor">
1641
+                <div class="editor" field_id="<?php echo $name; ?>" field_type="editor">
1642 1642
                     <?php wp_editor(stripslashes($value), $name, $editor_settings); ?>
1643 1643
                     </div><?php
1644 1644
 
1645 1645
                 } else {
1646 1646
 
1647
-                    ?><textarea field_type="<?php echo $type;?>" class="geodir_textarea" name="<?php echo $name;?>"
1648
-                                id="<?php echo $name;?>"><?php echo stripslashes($value);?></textarea><?php
1647
+                    ?><textarea field_type="<?php echo $type; ?>" class="geodir_textarea" name="<?php echo $name; ?>"
1648
+                                id="<?php echo $name; ?>"><?php echo stripslashes($value); ?></textarea><?php
1649 1649
 
1650 1650
                 }?>
1651 1651
 
1652 1652
 
1653
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1653
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1654 1654
                 <?php if ($is_required) { ?>
1655 1655
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1656 1656
                 <?php } ?>
1657 1657
             </div>
1658 1658
 
1659 1659
         <?php } elseif ($type == 'select') { ?>
1660
-            <div id="<?php echo $name;?>_row"
1661
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">
1660
+            <div id="<?php echo $name; ?>_row"
1661
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class; ?>">
1662 1662
                 <label>
1663 1663
                     <?php $site_title = __($site_title, 'geodirectory');
1664 1664
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1665
-                    <?php if ($is_required) echo '<span>*</span>';?>
1665
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1666 1666
                 </label>
1667 1667
                 <?php
1668 1668
                 $option_values_arr = geodir_string_values_to_options($option_values, true);
@@ -1683,11 +1683,11 @@  discard block
 block discarded – undo
1683 1683
                     }
1684 1684
                 }
1685 1685
                 ?>
1686
-                <select field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1686
+                <select field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1687 1687
                         class="geodir_textfield textfield_x chosen_select"
1688
-                        data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
1689
-                        option-ajaxchosen="false"><?php echo $select_options;?></select>
1690
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1688
+                        data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;'; ?>"
1689
+                        option-ajaxchosen="false"><?php echo $select_options; ?></select>
1690
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1691 1691
                 <?php if ($is_required) { ?>
1692 1692
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1693 1693
                 <?php } ?>
@@ -1701,7 +1701,7 @@  discard block
 block discarded – undo
1701 1701
             }
1702 1702
             ?>
1703 1703
             <div id="<?php echo $name; ?>_row"
1704
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1704
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1705 1705
                 <label>
1706 1706
                     <?php $site_title = __($site_title, 'geodirectory');
1707 1707
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
@@ -1775,7 +1775,7 @@  discard block
 block discarded – undo
1775 1775
             ?>
1776 1776
 
1777 1777
             <div id="<?php echo $name; ?>_row"
1778
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1778
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1779 1779
                 <label>
1780 1780
                     <?php $site_title = __($site_title, 'geodirectory');
1781 1781
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
@@ -1805,8 +1805,8 @@  discard block
 block discarded – undo
1805 1805
 
1806 1806
             $date_format = str_replace($search, $replace, $extra_fields['date_format']);
1807 1807
 
1808
-            if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
1809
-            if($value && !isset($_REQUEST['backandedit'])) {
1808
+            if ($value == '0000-00-00') {$value = ''; }//if date not set, then mark it empty
1809
+            if ($value && !isset($_REQUEST['backandedit'])) {
1810 1810
                 $time = strtotime($value);
1811 1811
                 $value = date($date_format, $time);
1812 1812
             }
@@ -1816,37 +1816,37 @@  discard block
 block discarded – undo
1816 1816
 
1817 1817
                 jQuery(function () {
1818 1818
 
1819
-                    jQuery("#<?php echo $name;?>").datepicker({changeMonth: true, changeYear: true <?php
1819
+                    jQuery("#<?php echo $name; ?>").datepicker({changeMonth: true, changeYear: true <?php
1820 1820
                     /**
1821 1821
                      * Used to add extra option to datepicker per custom field.
1822 1822
                      *
1823 1823
                      * @since 1.5.7
1824 1824
                      * @param string $name The custom field name.
1825 1825
                      */
1826
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
1826
+                    echo apply_filters("gd_datepicker_extra_{$name}", ''); ?>});
1827 1827
 
1828
-                    jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $extra_fields['date_format'];?>');
1828
+                    jQuery("#<?php echo $name; ?>").datepicker("option", "dateFormat", '<?php echo $extra_fields['date_format']; ?>');
1829 1829
 
1830
-                    <?php if(!empty($value)){?>
1831
-                    jQuery("#<?php echo $name;?>").datepicker("setDate", "<?php echo $value;?>");
1830
+                    <?php if (!empty($value)) {?>
1831
+                    jQuery("#<?php echo $name; ?>").datepicker("setDate", "<?php echo $value; ?>");
1832 1832
                     <?php } ?>
1833 1833
 
1834 1834
                 });
1835 1835
 
1836 1836
             </script>
1837
-            <div id="<?php echo $name;?>_row"
1838
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1837
+            <div id="<?php echo $name; ?>_row"
1838
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1839 1839
                 <label>
1840 1840
 
1841 1841
                     <?php $site_title = __($site_title, 'geodirectory');
1842 1842
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1843
-                    <?php if ($is_required) echo '<span>*</span>';?>
1843
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1844 1844
                 </label>
1845 1845
 
1846
-                <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1847
-                       value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
1846
+                <input field_type="<?php echo $type; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
1847
+                       value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
1848 1848
 
1849
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1849
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1850 1850
                 <?php if ($is_required) { ?>
1851 1851
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1852 1852
                 <?php } ?>
@@ -1860,25 +1860,25 @@  discard block
 block discarded – undo
1860 1860
             <script type="text/javascript">
1861 1861
                 jQuery(document).ready(function () {
1862 1862
 
1863
-                    jQuery('#<?php echo $name;?>').timepicker({
1863
+                    jQuery('#<?php echo $name; ?>').timepicker({
1864 1864
                         showPeriod: true,
1865 1865
                         showLeadingZero: true,
1866 1866
                         showPeriod: true,
1867 1867
                     });
1868 1868
                 });
1869 1869
             </script>
1870
-            <div id="<?php echo $name;?>_row"
1871
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1870
+            <div id="<?php echo $name; ?>_row"
1871
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1872 1872
                 <label>
1873 1873
 
1874 1874
                     <?php $site_title = __($site_title, 'geodirectory');
1875 1875
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1876
-                    <?php if ($is_required) echo '<span>*</span>';?>
1876
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1877 1877
                 </label>
1878
-                <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>"
1879
-                       id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
1878
+                <input readonly="readonly" field_type="<?php echo $type; ?>" name="<?php echo $name; ?>"
1879
+                       id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
1880 1880
 
1881
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1881
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1882 1882
                 <?php if ($is_required) { ?>
1883 1883
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1884 1884
                 <?php } ?>
@@ -1888,15 +1888,15 @@  discard block
 block discarded – undo
1888 1888
             if ($value == $val['default']) {
1889 1889
                 $value = '';
1890 1890
             } ?>
1891
-            <div id="<?php echo $name;?>_row"
1892
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1891
+            <div id="<?php echo $name; ?>_row"
1892
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
1893 1893
                 <label>
1894 1894
                     <?php $site_title = __($site_title, 'geodirectory');
1895 1895
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1896
-                    <?php if ($is_required) echo '<span>*</span>';?>
1896
+                    <?php if ($is_required) echo '<span>*</span>'; ?>
1897 1897
                 </label>
1898 1898
 
1899
-                <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1899
+                <div id="<?php echo $name; ?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1900 1900
                     <?php
1901 1901
                     global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1902 1902
 
@@ -1908,7 +1908,7 @@  discard block
 block discarded – undo
1908 1908
 
1909 1909
                         $package_info = array();
1910 1910
 
1911
-                        $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1911
+                        $package_info = (array) geodir_post_package_info($package_info, $post, $post_type);
1912 1912
 
1913 1913
                         if (!empty($package_info)) {
1914 1914
 
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
                     ?>
1992 1992
                 </div>
1993 1993
 
1994
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1994
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1995 1995
                 <?php if ($is_required) { ?>
1996 1996
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1997 1997
                 <?php } ?>
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
                     $file_totImg = count($curImages);
2034 2034
             }
2035 2035
 			
2036
-			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
2036
+			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : '';
2037 2037
 			$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
2038 2038
 
2039 2039
             ?>
@@ -2044,13 +2044,13 @@  discard block
 block discarded – undo
2044 2044
 			</h5>   <?php */
2045 2045
             ?>
2046 2046
 
2047
-            <div id="<?php echo $name;?>_row"
2048
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2047
+            <div id="<?php echo $name; ?>_row"
2048
+                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class; ?>">
2049 2049
 
2050 2050
                 <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
2051 2051
                     <label
2052 2052
                         style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
2053
-                        echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
2053
+                        echo $site_title; ?><?php if ($is_required) echo '<span>*</span>'; ?></label>
2054 2054
                     <input class="geodir-custom-file-upload" field_type="file" type="hidden"
2055 2055
                            name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
2056 2056
                            value="<?php echo esc_attr($file_value); ?>"/>
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
                            id="<?php echo $file_id; ?>image_limit" value="<?php echo $file_image_limit; ?>"/>
2059 2059
 					<?php if ($allowed_file_types != '') { ?>
2060 2060
 					<input type="hidden" name="<?php echo $file_id; ?>_allowed_types"
2061
-                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types);?>"/>
2061
+                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types); ?>"/>
2062 2062
 					<?php } ?>
2063 2063
                     <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
2064 2064
                            value="<?php if (isset($file_totImg)) {
@@ -2074,7 +2074,7 @@  discard block
 block discarded – undo
2074 2074
                             <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
2075 2075
                             ?>
2076 2076
                             <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
2077
-                                   value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
2077
+                                   value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory')); ?>"
2078 2078
                                    class="geodir_button" style="margin-top:10px;"/>
2079 2079
                             <span class="ajaxnonceplu"
2080 2080
                                   id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?>"></span>
@@ -2097,7 +2097,7 @@  discard block
 block discarded – undo
2097 2097
 
2098 2098
                     </div>
2099 2099
                 </div>
2100
-                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?> <?php echo ( $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : '' );?></span>
2100
+                <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo ($display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : ''); ?></span>
2101 2101
                 <?php if ($is_required) { ?>
2102 2102
                     <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2103 2103
                 <?php } ?>
@@ -2202,7 +2202,7 @@  discard block
 block discarded – undo
2202 2202
 
2203 2203
                 $variables_array = array();
2204 2204
 
2205
-                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int)$type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2205
+                if ($fields_location == 'detail' && isset($type['show_as_tab']) && (int) $type['show_as_tab'] == 1 && in_array($type['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2206 2206
                     continue;
2207 2207
                 }
2208 2208
 
@@ -2228,12 +2228,12 @@  discard block
 block discarded – undo
2228 2228
 
2229 2229
                     case 'fieldset':
2230 2230
 
2231
-                        $fieldset_class = 'fieldset-'.sanitize_title_with_dashes($type['site_title']);
2231
+                        $fieldset_class = 'fieldset-' . sanitize_title_with_dashes($type['site_title']);
2232 2232
 
2233 2233
                         if ($field_set_start == 1) {
2234
-                            echo '</div><div class="geodir-company_info field-group ' . $type['htmlvar_name'] . '"><h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';
2234
+                            echo '</div><div class="geodir-company_info field-group ' . $type['htmlvar_name'] . '"><h2 class="' . $fieldset_class . '">' . __($type['site_title'], 'geodirectory') . '</h2>';
2235 2235
                         } else {
2236
-                            echo '<h2 class="'.$fieldset_class.'">' . __($type['site_title'], 'geodirectory') . '</h2>';
2236
+                            echo '<h2 class="' . $fieldset_class . '">' . __($type['site_title'], 'geodirectory') . '</h2>';
2237 2237
                             $field_set_start = 1;
2238 2238
                         }
2239 2239
 
@@ -2405,7 +2405,7 @@  discard block
 block discarded – undo
2405 2405
 
2406 2406
 							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2407 2407
 							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2408
-                            if(!empty($type['default_value'])){$title = $type['default_value'];}
2408
+                            if (!empty($type['default_value'])) {$title = $type['default_value']; }
2409 2409
 							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2410 2410
 
2411 2411
 
@@ -2518,17 +2518,17 @@  discard block
 block discarded – undo
2518 2518
                                 $date_format = $date_format['date_format'];
2519 2519
                             }
2520 2520
 
2521
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2522
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
2521
+                            $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
2522
+                            $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
2523 2523
 
2524 2524
                             $date_format = str_replace($search, $replace, $date_format);
2525 2525
 
2526 2526
                             $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->{$type['htmlvar_name']}) : $post->{$type['htmlvar_name']}; // PHP doesn't work well with dd/mm/yyyy format
2527 2527
 
2528 2528
                             $value = '';
2529
-                            if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
2529
+                            if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']} != "0000-00-00") {
2530 2530
                                 $value = date($date_format, strtotime($post_htmlvar_value));
2531
-                            }else{
2531
+                            } else {
2532 2532
                                 continue;
2533 2533
                             }
2534 2534
 
@@ -2671,7 +2671,7 @@  discard block
 block discarded – undo
2671 2671
 
2672 2672
                         $html_var = $type['htmlvar_name'];
2673 2673
 
2674
-                        if ((int)$post->$html_var == 1):
2674
+                        if ((int) $post->$html_var == 1):
2675 2675
 
2676 2676
                             if ($post->{$type['htmlvar_name']} == '1'):
2677 2677
                                 $html_val = __('Yes', 'geodirectory');
@@ -2899,8 +2899,8 @@  discard block
 block discarded – undo
2899 2899
                                 $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2900 2900
                                 $html .= (trim($type['site_title'])) ? __($type['site_title'], 'geodirectory') . ': ' : '';
2901 2901
                                 $html .= '</span><span class="geodir-email-address-output">';
2902
-                                $email = stripslashes($post->{$type['htmlvar_name']}) ;
2903
-                                if($e_split = explode('@',$email)){
2902
+                                $email = stripslashes($post->{$type['htmlvar_name']});
2903
+                                if ($e_split = explode('@', $email)) {
2904 2904
                                     /**
2905 2905
                                      * Filter email custom field name output.
2906 2906
                                      *
@@ -2909,10 +2909,10 @@  discard block
 block discarded – undo
2909 2909
                                      * @param string $email The email string being output.
2910 2910
                                      * @param array $type Custom field variables array.
2911 2911
                                      */
2912
-                                    $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
2913
-                                    $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
2914
-                                }else{
2915
-                                    $html .=  $email;
2912
+                                    $email_name = apply_filters('geodir_email_field_name_output', $email, $type);
2913
+                                    $html .= "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
2914
+                                } else {
2915
+                                    $html .= $email;
2916 2916
                                 }
2917 2917
                                 $html .= '</span></div>';
2918 2918
                             }
@@ -2932,7 +2932,7 @@  discard block
 block discarded – undo
2932 2932
                             if (!empty($files)):
2933 2933
 
2934 2934
                                $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2935
-							   $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2935
+							   $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
2936 2936
 								
2937 2937
 								$file_paths = '';
2938 2938
                                 foreach ($files as $file) {
@@ -2963,7 +2963,7 @@  discard block
 block discarded – undo
2963 2963
                                         // If the uploaded file is image
2964 2964
                                         if (in_array($uploaded_file_type, $image_file_types)) {
2965 2965
                                             $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2966
-                                            $file_paths .= '<a href="'.$file.'">';
2966
+                                            $file_paths .= '<a href="' . $file . '">';
2967 2967
 											$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2968 2968
 											$file_paths .= '</a>';
2969 2969
                                             //$file_paths .= '<img src="'.$file.'"  />';	
@@ -3100,7 +3100,7 @@  discard block
 block discarded – undo
3100 3100
                                     $terms = $termsOrdered;
3101 3101
                                 }
3102 3102
                             }
3103
-                            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object)$terms) : '';
3103
+                            $html_value = !empty($links) && !empty($terms) ? wp_sprintf('%l', $links, (object) $terms) : '';
3104 3104
 
3105 3105
                             if ($html_value != '') {
3106 3106
                                 if (strpos($field_icon, 'http') !== false) {
@@ -3262,7 +3262,7 @@  discard block
 block discarded – undo
3262 3262
             $geodir_uploadurl = $uploads['url'];
3263 3263
             $sub_dir = $uploads['subdir'];
3264 3264
 			
3265
-			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
3265
+			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
3266 3266
 
3267 3267
             for ($m = 0; $m < count($post_image); $m++) {
3268 3268
 
@@ -3333,8 +3333,8 @@  discard block
 block discarded – undo
3333 3333
         if (!empty($postcurr_images)) {
3334 3334
 
3335 3335
             if ($file_urls != $postcurr_images) {
3336
-                $invalid_files[] = (object)array('src' => $postcurr_images);
3337
-                $invalid_files = (object)$invalid_files;
3336
+                $invalid_files[] = (object) array('src' => $postcurr_images);
3337
+                $invalid_files = (object) $invalid_files;
3338 3338
             }
3339 3339
         }
3340 3340
 
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
         // remove handle custom file uploaddir
3417 3417
         remove_filter('upload_dir', 'geodir_upload_dir');
3418 3418
 
3419
-        if(!isset($status['url']) && isset($status['error'])){
3419
+        if (!isset($status['url']) && isset($status['error'])) {
3420 3420
             print_r($status);
3421 3421
         }
3422 3422
 
@@ -3492,10 +3492,10 @@  discard block
 block discarded – undo
3492 3492
 	 */
3493 3493
 	function geodir_max_upload_size()
3494 3494
     {
3495
-        $max_filesize = (float)get_option('geodir_upload_max_filesize', 2);
3495
+        $max_filesize = (float) get_option('geodir_upload_max_filesize', 2);
3496 3496
 
3497 3497
         if ($max_filesize > 0 && $max_filesize < 1) {
3498
-            $max_filesize = (int)($max_filesize * 1024) . 'kb';
3498
+            $max_filesize = (int) ($max_filesize * 1024) . 'kb';
3499 3499
         } else {
3500 3500
             $max_filesize = $max_filesize > 0 ? $max_filesize . 'mb' : '2mb';
3501 3501
         }
@@ -3803,7 +3803,7 @@  discard block
 block discarded – undo
3803 3803
         }
3804 3804
 
3805 3805
 
3806
-        return (int)$lastid;
3806
+        return (int) $lastid;
3807 3807
 
3808 3808
     }
3809 3809
 }
@@ -3894,38 +3894,38 @@  discard block
 block discarded – undo
3894 3894
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
3895 3895
         
3896 3896
         ?>
3897
-        <li class="text" id="licontainer_<?php echo $result_str;?>">
3898
-            <div class="title title<?php echo $result_str;?> gt-fieldset"
3899
-                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory');?>"
3900
-                 ondblclick="show_hide('field_frm<?php echo $result_str;?>')">
3897
+        <li class="text" id="licontainer_<?php echo $result_str; ?>">
3898
+            <div class="title title<?php echo $result_str; ?> gt-fieldset"
3899
+                 title="<?php _e('Double Click to toggle and drag-drop to sort', 'geodirectory'); ?>"
3900
+                 ondblclick="show_hide('field_frm<?php echo $result_str; ?>')">
3901 3901
                 <?php
3902 3902
 
3903 3903
                 $nonce = wp_create_nonce('custom_fields_' . $result_str);
3904 3904
                 ?>
3905 3905
 
3906
-                <div title="<?php _e('Click to remove field', 'geodirectory');?>"
3907
-                     onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
3906
+                <div title="<?php _e('Click to remove field', 'geodirectory'); ?>"
3907
+                     onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
3908 3908
                      class="handlediv close"></div>
3909 3909
 
3910 3910
                 <b style="cursor:pointer;"
3911
-                   onclick="show_hide('field_frm<?php echo $result_str;?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')');?></b>
3911
+                   onclick="show_hide('field_frm<?php echo $result_str; ?>')"><?php echo geodir_ucwords(__('Field:', 'geodirectory') . ' (' . $site_title . ')'); ?></b>
3912 3912
 
3913 3913
             </div>
3914 3914
 
3915
-            <div id="field_frm<?php echo $result_str;?>" class="field_frm"
3915
+            <div id="field_frm<?php echo $result_str; ?>" class="field_frm"
3916 3916
                  style="display:<?php if ($field_ins_upd == 'submit') {
3917 3917
                      echo 'block;';
3918 3918
                  } else {
3919 3919
                      echo 'none;';
3920 3920
                  } ?>">
3921 3921
                 <input type="hidden" name="_wpnonce" value="<?php echo $nonce; ?>"/>
3922
-                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type;?>"/>
3923
-                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type;?>"/>
3924
-                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str;?>"/>
3922
+                <input type="hidden" name="listing_type" id="listing_type" value="<?php echo $post_type; ?>"/>
3923
+                <input type="hidden" name="field_type" id="field_type" value="<?php echo $field_type; ?>"/>
3924
+                <input type="hidden" name="field_id" id="field_id" value="<?php echo $result_str; ?>"/>
3925 3925
                 <input type="hidden" name="data_type" id="data_type" value="<?php if (isset($field_info->data_type)) {
3926 3926
                     echo $field_info->data_type;
3927 3927
                 }?>"/>
3928
-                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name;?>"/>
3928
+                <input type="hidden" name="htmlvar_name" id="htmlvar_name" value="<?php echo $htmlvar_name; ?>"/>
3929 3929
 
3930 3930
 
3931 3931
                 <table class="widefat post fixed" border="0" style="width:100%;">
@@ -4007,42 +4007,42 @@  discard block
 block discarded – undo
4007 4007
                     <?php } ?>
4008 4008
 
4009 4009
                     <tr>
4010
-                        <td><strong><?php _e('Is active :', 'geodirectory');?></strong></td>
4010
+                        <td><strong><?php _e('Is active :', 'geodirectory'); ?></strong></td>
4011 4011
                         <td align="left">
4012 4012
                             <select name="is_active" id="is_active">
4013 4013
                                 <option
4014 4014
                                     value="1" <?php if (isset($field_info->is_active) && $field_info->is_active == '1') {
4015 4015
                                     echo 'selected="selected"';
4016
-                                }?>><?php _e('Yes', 'geodirectory');?></option>
4016
+                                }?>><?php _e('Yes', 'geodirectory'); ?></option>
4017 4017
                                 <option
4018 4018
                                     value="0" <?php if (isset($field_info->is_active) && $field_info->is_active == '0') {
4019 4019
                                     echo 'selected="selected"';
4020
-                                }?>><?php _e('No', 'geodirectory');?></option>
4020
+                                }?>><?php _e('No', 'geodirectory'); ?></option>
4021 4021
                             </select>
4022 4022
                             <br/>
4023
-                            <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory');?></span>
4023
+                            <span><?php _e('Select yes or no. If no is selected then the field will not be displayed anywhere.', 'geodirectory'); ?></span>
4024 4024
                         </td>
4025 4025
                     </tr>
4026 4026
 
4027 4027
                     <tr>
4028
-                        <td><strong><?php _e('Display order :', 'geodirectory');?></strong></td>
4028
+                        <td><strong><?php _e('Display order :', 'geodirectory'); ?></strong></td>
4029 4029
                         <td align="left"><input type="text" readonly="readonly" name="sort_order" id="sort_order"
4030 4030
                                                 value="<?php if (isset($field_info->sort_order)) {
4031 4031
                                                     echo esc_attr($field_info->sort_order);
4032 4032
                                                 }?>" size="50"/>
4033 4033
                             <br/>
4034
-                            <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory');?></span>
4034
+                            <span><?php _e('Enter the display order of this field in backend. e.g. 5', 'geodirectory'); ?></span>
4035 4035
                         </td>
4036 4036
                     </tr>
4037 4037
 
4038 4038
                     <tr>
4039 4039
                         <td>&nbsp;</td>
4040 4040
                         <td align="left">
4041
-                            <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory');?>"
4042
-                                   onclick="save_sort_field('<?php echo $result_str;?>')"/>
4041
+                            <input type="button" class="button" name="save" id="save" value="<?php esc_attr_e('Save', 'geodirectory'); ?>"
4042
+                                   onclick="save_sort_field('<?php echo $result_str; ?>')"/>
4043 4043
 
4044
-                            <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory');?>"
4045
-                                                                onclick="delete_sort_field('<?php echo $result_str;?>', '<?php echo $nonce;?>', this)"
4044
+                            <a href="javascript:void(0)"><input type="button" name="delete" value="<?php esc_attr_e('Delete', 'geodirectory'); ?>"
4045
+                                                                onclick="delete_sort_field('<?php echo $result_str; ?>', '<?php echo $nonce; ?>', this)"
4046 4046
                                                                 class="button_n"/></a>
4047 4047
 
4048 4048
                         </td>
@@ -4077,7 +4077,7 @@  discard block
 block discarded – undo
4077 4077
         if (!$package_id || !$field_name || !$post_type) {
4078 4078
             return true;
4079 4079
         }
4080
-        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int)$package_id));
4080
+        $sql = $wpdb->prepare("SELECT id FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE is_active='1' AND htmlvar_name=%s AND post_type=%s AND FIND_IN_SET(%s, packages)", array($field_name, $post_type, (int) $package_id));
4081 4081
 
4082 4082
         if ($wpdb->get_var($sql)) {
4083 4083
             return true;
Please login to merge, or discard this patch.
Braces   +369 added lines, -184 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
51 51
         global $wpdb;
52 52
         $result = 0;// no rows affected
53 53
         if (!geodir_column_exist($db, $column)) {
54
-            if (!empty($db) && !empty($column))
55
-                $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
54
+            if (!empty($db) && !empty($column)) {
55
+                            $result = $wpdb->query("ALTER TABLE `$db` ADD `$column`  $column_attr");
56
+            }
56 57
         }
57 58
         return $result;
58 59
     }
@@ -82,10 +83,11 @@  discard block
 block discarded – undo
82 83
 
83 84
     $default_query = '';
84 85
 
85
-    if ($default == 'default')
86
-        $default_query = " and is_default IN ('1') ";
87
-    elseif ($default == 'custom')
88
-        $default_query = " and is_default = '0' ";
86
+    if ($default == 'default') {
87
+            $default_query = " and is_default IN ('1') ";
88
+    } elseif ($default == 'custom') {
89
+            $default_query = " and is_default = '0' ";
90
+    }
89 91
 
90 92
     if ($fields_location == 'detail') {
91 93
         $default_query = " and show_on_detail='1' ";
@@ -240,10 +242,12 @@  discard block
 block discarded – undo
240 242
                 }
241 243
 
242 244
                 return $field_id;
243
-            } else
244
-                return 0;
245
-        } else
246
-            return 0;
245
+            } else {
246
+                            return 0;
247
+            }
248
+        } else {
249
+                    return 0;
250
+        }
247 251
     }
248 252
 }
249 253
 
@@ -351,7 +355,9 @@  discard block
 block discarded – undo
351 355
 		}*/
352 356
 
353 357
 
354
-            if ($post_type == '') $post_type = 'gd_place';
358
+            if ($post_type == '') {
359
+                $post_type = 'gd_place';
360
+            }
355 361
 
356 362
 
357 363
             $detail_table = $plugin_prefix . $post_type . '_detail';
@@ -384,20 +390,23 @@  discard block
 block discarded – undo
384 390
             }
385 391
 
386 392
             $option_values = '';
387
-            if (isset($request_field['option_values']))
388
-                $option_values = $request_field['option_values'];
393
+            if (isset($request_field['option_values'])) {
394
+                            $option_values = $request_field['option_values'];
395
+            }
389 396
 
390 397
             $cat_sort = '';
391
-            if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort']))
392
-                $cat_sort = implode(",", $request_field['cat_sort']);
398
+            if (isset($request_field['cat_sort']) && !empty($request_field['cat_sort'])) {
399
+                            $cat_sort = implode(",", $request_field['cat_sort']);
400
+            }
393 401
 
394 402
             $cat_filter = '';
395
-            if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter']))
396
-                $cat_filter = implode(",", $request_field['cat_filter']);
403
+            if (isset($request_field['cat_filter']) && !empty($request_field['cat_filter'])) {
404
+                            $cat_filter = implode(",", $request_field['cat_filter']);
405
+            }
397 406
 
398
-            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg']))
399
-                $price_pkg = implode(",", $request_field['show_on_pkg']);
400
-            else {
407
+            if (isset($request_field['show_on_pkg']) && !empty($request_field['show_on_pkg'])) {
408
+                            $price_pkg = implode(",", $request_field['show_on_pkg']);
409
+            } else {
401 410
                 $package_info = array();
402 411
 
403 412
                 $package_info = geodir_post_package_info($package_info, '', $post_type);
@@ -405,22 +414,29 @@  discard block
 block discarded – undo
405 414
             }
406 415
 
407 416
 
408
-            if (isset($request_field['extra']) && !empty($request_field['extra']))
409
-                $extra_fields = $request_field['extra'];
417
+            if (isset($request_field['extra']) && !empty($request_field['extra'])) {
418
+                            $extra_fields = $request_field['extra'];
419
+            }
410 420
 
411
-            if (isset($request_field['is_default']) && $request_field['is_default'] != '')
412
-                $is_default = $request_field['is_default'];
413
-            else
414
-                $is_default = '0';
421
+            if (isset($request_field['is_default']) && $request_field['is_default'] != '') {
422
+                            $is_default = $request_field['is_default'];
423
+            } else {
424
+                            $is_default = '0';
425
+            }
415 426
 
416
-            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '')
417
-                $is_admin = $request_field['is_admin'];
418
-            else
419
-                $is_admin = '0';
427
+            if (isset($request_field['is_admin']) && $request_field['is_admin'] != '') {
428
+                            $is_admin = $request_field['is_admin'];
429
+            } else {
430
+                            $is_admin = '0';
431
+            }
420 432
 
421 433
 
422
-            if ($is_active == '') $is_active = 1;
423
-            if ($is_required == '') $is_required = 0;
434
+            if ($is_active == '') {
435
+                $is_active = 1;
436
+            }
437
+            if ($is_required == '') {
438
+                $is_required = 0;
439
+            }
424 440
 
425 441
 
426 442
             if ($sort_order == '') {
@@ -688,7 +704,7 @@  discard block
 block discarded – undo
688 704
                             }
689 705
                             if($op_max){$op_size =$op_max; }
690 706
                         }
691
-                    }elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
707
+                    } elseif(isset($option_values) && $option_values && $field_type=='multiselect'){
692 708
                         if(strlen($option_values)){
693 709
                             $op_size =  strlen($option_values);
694 710
                         }
@@ -705,11 +721,13 @@  discard block
 block discarded – undo
705 721
                         return __('Column change failed, you may have too many columns.','geodirectory');
706 722
                     }
707 723
 
708
-                        if (isset($request_field['cat_display_type']))
709
-                            $extra_fields = $request_field['cat_display_type'];
724
+                        if (isset($request_field['cat_display_type'])) {
725
+                                                    $extra_fields = $request_field['cat_display_type'];
726
+                        }
710 727
 
711
-                        if (isset($request_field['multi_display_type']))
712
-                            $extra_fields = $request_field['multi_display_type'];
728
+                        if (isset($request_field['multi_display_type'])) {
729
+                                                    $extra_fields = $request_field['multi_display_type'];
730
+                        }
713 731
 
714 732
 
715 733
                         break;
@@ -721,8 +739,9 @@  discard block
 block discarded – undo
721 739
                     if($alter_result===false){
722 740
                         return __('Column change failed, you may have too many columns.','geodirectory');
723 741
                     }
724
-                        if (isset($request_field['advanced_editor']))
725
-                            $extra_fields = $request_field['advanced_editor'];
742
+                        if (isset($request_field['advanced_editor'])) {
743
+                                                    $extra_fields = $request_field['advanced_editor'];
744
+                        }
726 745
 
727 746
                         break;
728 747
 
@@ -816,8 +835,9 @@  discard block
 block discarded – undo
816 835
                 );
817 836
 
818 837
 
819
-                if ($cat_sort == '')
820
-                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
838
+                if ($cat_sort == '') {
839
+                                    $wpdb->query($wpdb->prepare("delete from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where post_type = %s and htmlvar_name = %s", array($post_type, $htmlvar_name)));
840
+                }
821 841
 
822 842
 
823 843
                 /**
@@ -1184,8 +1204,10 @@  discard block
 block discarded – undo
1184 1204
         }
1185 1205
 
1186 1206
         return $post_meta_info;
1187
-    else:
1188
-        return false;
1207
+    else {
1208
+        :
1209
+        return false;
1210
+    }
1189 1211
     endif;
1190 1212
 }
1191 1213
 
@@ -1238,8 +1260,9 @@  discard block
 block discarded – undo
1238 1260
         if (is_admin()) {
1239 1261
             global $post;
1240 1262
 
1241
-            if (isset($_REQUEST['post']))
1242
-                $_REQUEST['pid'] = $_REQUEST['post'];
1263
+            if (isset($_REQUEST['post'])) {
1264
+                            $_REQUEST['pid'] = $_REQUEST['post'];
1265
+            }
1243 1266
         }
1244 1267
 
1245 1268
         if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
@@ -1271,7 +1294,10 @@  discard block
 block discarded – undo
1271 1294
             $fieldset_field_class = 'gd-fieldset-' . $fieldset_id;
1272 1295
             ?>
1273 1296
             <h5 id="geodir_fieldset_<?php echo $fieldset_id;?>" class="geodir-fieldset-row" gd-fieldset="<?php echo $fieldset_id;?>"><?php echo $site_title;?>
1274
-            <?php if ($admin_desc != '') echo '<small>( ' . $admin_desc . ' )</small>';?></h5>
1297
+            <?php if ($admin_desc != '') {
1298
+    echo '<small>( ' . $admin_desc . ' )</small>';
1299
+}
1300
+?></h5>
1275 1301
             <?php
1276 1302
         } else if ($type == 'address') {
1277 1303
             $prefix = $name . '_';
@@ -1308,17 +1334,27 @@  discard block
 block discarded – undo
1308 1334
             }
1309 1335
 
1310 1336
             $location = geodir_get_default_location();
1311
-            if (empty($city)) $city = isset($location->city) ? $location->city : '';
1312
-            if (empty($region)) $region = isset($location->region) ? $location->region : '';
1313
-            if (empty($country)) $country = isset($location->country) ? $location->country : '';
1337
+            if (empty($city)) {
1338
+                $city = isset($location->city) ? $location->city : '';
1339
+            }
1340
+            if (empty($region)) {
1341
+                $region = isset($location->region) ? $location->region : '';
1342
+            }
1343
+            if (empty($country)) {
1344
+                $country = isset($location->country) ? $location->country : '';
1345
+            }
1314 1346
 
1315 1347
             $lat_lng_blank = false;
1316 1348
             if (empty($lat) && empty($lng)) {
1317 1349
                 $lat_lng_blank = true;
1318 1350
             }
1319 1351
 
1320
-            if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1321
-            if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1352
+            if (empty($lat)) {
1353
+                $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1354
+            }
1355
+            if (empty($lng)) {
1356
+                $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1357
+            }
1322 1358
 
1323 1359
             /**
1324 1360
              * Filter the default latitude.
@@ -1342,10 +1378,16 @@  discard block
 block discarded – undo
1342 1378
             ?>
1343 1379
 
1344 1380
             <div id="geodir_<?php echo $prefix . 'address';?>_row"
1345
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1381
+                 class="<?php if ($is_required) {
1382
+    echo 'required_field';
1383
+}
1384
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1346 1385
                 <label>
1347 1386
                     <?php _e($address_title, 'geodirectory'); ?>
1348
-                    <?php if ($is_required) echo '<span>*</span>';?>
1387
+                    <?php if ($is_required) {
1388
+    echo '<span>*</span>';
1389
+}
1390
+?>
1349 1391
                 </label>
1350 1392
                 <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>"
1351 1393
                        id="<?php echo $prefix . 'address';?>" class="geodir_textfield"
@@ -1406,10 +1448,16 @@  discard block
 block discarded – undo
1406 1448
                 /* show lat lng */
1407 1449
                 $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1408 1450
                 <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1409
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1451
+                     class="<?php if ($is_required) {
1452
+    echo 'required_field';
1453
+}
1454
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1410 1455
                     <label>
1411 1456
                         <?php echo PLACE_ADDRESS_LAT; ?>
1412
-                        <?php if ($is_required) echo '<span>*</span>'; ?>
1457
+                        <?php if ($is_required) {
1458
+    echo '<span>*</span>';
1459
+}
1460
+?>
1413 1461
                     </label>
1414 1462
                     <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1415 1463
                            id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
@@ -1421,10 +1469,16 @@  discard block
 block discarded – undo
1421 1469
                 </div>
1422 1470
 
1423 1471
                 <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1424
-                     class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1472
+                     class="<?php if ($is_required) {
1473
+    echo 'required_field';
1474
+}
1475
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>" <?php echo $style_latlng; ?>>
1425 1476
                     <label>
1426 1477
                         <?php echo PLACE_ADDRESS_LNG; ?>
1427
-                        <?php if ($is_required) echo '<span>*</span>'; ?>
1478
+                        <?php if ($is_required) {
1479
+    echo '<span>*</span>';
1480
+}
1481
+?>
1428 1482
                     </label>
1429 1483
                     <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1430 1484
                            id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
@@ -1479,26 +1533,31 @@  discard block
 block discarded – undo
1479 1533
         <?php } elseif ($type == 'text') {
1480 1534
 
1481 1535
             //number and float validation $validation_pattern
1482
-            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';}
1483
-            elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1536
+            if(isset($val['data_type']) && $val['data_type']=='INT'){$type = 'number';} elseif(isset($val['data_type']) && $val['data_type']=='FLOAT'){$type = 'float';}
1484 1537
             //print_r($val);
1485 1538
             //validation
1486 1539
             if(isset($val['validation_pattern']) && $val['validation_pattern']){
1487 1540
                 $validation = 'pattern="'.$val['validation_pattern'].'"';
1488
-            }else{$validation='';}
1541
+            } else{$validation='';}
1489 1542
 
1490 1543
             // validation message
1491 1544
             if(isset($val['validation_msg']) && $val['validation_msg']){
1492 1545
                 $validation_msg = 'title="'.$val['validation_msg'].'"';
1493
-            }else{$validation_msg='';}
1546
+            } else{$validation_msg='';}
1494 1547
             ?>
1495 1548
 
1496 1549
             <div id="<?php echo $name;?>_row"
1497
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1550
+                 class="<?php if ($is_required) {
1551
+    echo 'required_field';
1552
+}
1553
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1498 1554
                 <label>
1499 1555
                     <?php $site_title = __($site_title, 'geodirectory');
1500 1556
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1501
-                    <?php if ($is_required) echo '<span>*</span>';?>
1557
+                    <?php if ($is_required) {
1558
+    echo '<span>*</span>';
1559
+}
1560
+?>
1502 1561
                 </label>
1503 1562
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1504 1563
                        value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
@@ -1514,11 +1573,17 @@  discard block
 block discarded – undo
1514 1573
             }?>
1515 1574
 
1516 1575
             <div id="<?php echo $name;?>_row"
1517
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1576
+                 class="<?php if ($is_required) {
1577
+    echo 'required_field';
1578
+}
1579
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1518 1580
                 <label>
1519 1581
                     <?php $site_title = __($site_title, 'geodirectory');
1520 1582
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1521
-                    <?php if ($is_required) echo '<span>*</span>';?>
1583
+                    <?php if ($is_required) {
1584
+    echo '<span>*</span>';
1585
+}
1586
+?>
1522 1587
                 </label>
1523 1588
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1524 1589
                        value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
@@ -1534,11 +1599,17 @@  discard block
 block discarded – undo
1534 1599
             } ?>
1535 1600
 
1536 1601
             <div id="<?php echo $name;?>_row"
1537
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1602
+                 class="<?php if ($is_required) {
1603
+    echo 'required_field';
1604
+}
1605
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1538 1606
                 <label>
1539 1607
                     <?php $site_title = __($site_title, 'geodirectory');
1540 1608
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1541
-                    <?php if ($is_required) echo '<span>*</span>';?>
1609
+                    <?php if ($is_required) {
1610
+    echo '<span>*</span>';
1611
+}
1612
+?>
1542 1613
                 </label>
1543 1614
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1544 1615
                        value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
@@ -1554,11 +1625,17 @@  discard block
 block discarded – undo
1554 1625
             }?>
1555 1626
 
1556 1627
             <div id="<?php echo $name;?>_row"
1557
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1628
+                 class="<?php if ($is_required) {
1629
+    echo 'required_field';
1630
+}
1631
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1558 1632
                 <label>
1559 1633
                     <?php $site_title = __($site_title, 'geodirectory');
1560 1634
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1561
-                    <?php if ($is_required) echo '<span>*</span>';?>
1635
+                    <?php if ($is_required) {
1636
+    echo '<span>*</span>';
1637
+}
1638
+?>
1562 1639
                 </label>
1563 1640
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
1564 1641
                        value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
@@ -1573,11 +1650,17 @@  discard block
 block discarded – undo
1573 1650
 
1574 1651
         <?php } elseif ($type == 'radio') { ?>
1575 1652
             <div id="<?php echo $name;?>_row"
1576
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1653
+                 class="<?php if ($is_required) {
1654
+    echo 'required_field';
1655
+}
1656
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1577 1657
                 <label>
1578 1658
                     <?php $site_title = __($site_title, 'geodirectory');
1579 1659
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1580
-                    <?php if ($is_required) echo '<span>*</span>';?>
1660
+                    <?php if ($is_required) {
1661
+    echo '<span>*</span>';
1662
+}
1663
+?>
1581 1664
                 </label>
1582 1665
 				<?php if ($option_values) {
1583 1666
                     $option_values = geodir_string_values_to_options($option_values, true);
@@ -1602,11 +1685,17 @@  discard block
 block discarded – undo
1602 1685
         <?php } elseif ($type == 'checkbox') { ?>
1603 1686
 
1604 1687
             <div id="<?php echo $name;?>_row"
1605
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1688
+                 class="<?php if ($is_required) {
1689
+    echo 'required_field';
1690
+}
1691
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1606 1692
                 <label>
1607 1693
                     <?php $site_title = __($site_title, 'geodirectory');
1608 1694
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1609
-                    <?php if ($is_required) echo '<span>*</span>';?>
1695
+                    <?php if ($is_required) {
1696
+    echo '<span>*</span>';
1697
+}
1698
+?>
1610 1699
                 </label>
1611 1700
                 <?php if ($value != '1') {
1612 1701
                     $value = '0';
@@ -1626,11 +1715,17 @@  discard block
 block discarded – undo
1626 1715
             ?>
1627 1716
 
1628 1717
             <div id="<?php echo $name;?>_row"
1629
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1718
+                 class="<?php if ($is_required) {
1719
+    echo 'required_field';
1720
+}
1721
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1630 1722
                 <label>
1631 1723
                     <?php $site_title = __($site_title, 'geodirectory');
1632 1724
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1633
-                    <?php if ($is_required) echo '<span>*</span>';?>
1725
+                    <?php if ($is_required) {
1726
+    echo '<span>*</span>';
1727
+}
1728
+?>
1634 1729
                 </label><?php
1635 1730
 
1636 1731
 
@@ -1658,11 +1753,17 @@  discard block
 block discarded – undo
1658 1753
 
1659 1754
         <?php } elseif ($type == 'select') { ?>
1660 1755
             <div id="<?php echo $name;?>_row"
1661
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">
1756
+                 class="<?php if ($is_required) {
1757
+    echo 'required_field';
1758
+}
1759
+?> geodir_form_row geodir_custom_fields clearfix <?php echo $fieldset_field_class;?>">
1662 1760
                 <label>
1663 1761
                     <?php $site_title = __($site_title, 'geodirectory');
1664 1762
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1665
-                    <?php if ($is_required) echo '<span>*</span>';?>
1763
+                    <?php if ($is_required) {
1764
+    echo '<span>*</span>';
1765
+}
1766
+?>
1666 1767
                 </label>
1667 1768
                 <?php
1668 1769
                 $option_values_arr = geodir_string_values_to_options($option_values, true);
@@ -1701,11 +1802,17 @@  discard block
 block discarded – undo
1701 1802
             }
1702 1803
             ?>
1703 1804
             <div id="<?php echo $name; ?>_row"
1704
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1805
+                 class="<?php if ($is_required) {
1806
+    echo 'required_field';
1807
+}
1808
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1705 1809
                 <label>
1706 1810
                     <?php $site_title = __($site_title, 'geodirectory');
1707 1811
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1708
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1812
+                    <?php if ($is_required) {
1813
+    echo '<span>*</span>';
1814
+}
1815
+?>
1709 1816
                 </label>
1710 1817
                 <input type="hidden" name="gd_field_<?php echo $name; ?>" value="1"/>
1711 1818
                 <?php if ($multi_display == 'select') { ?>
@@ -1775,11 +1882,17 @@  discard block
 block discarded – undo
1775 1882
             ?>
1776 1883
 
1777 1884
             <div id="<?php echo $name; ?>_row"
1778
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1885
+                 class="<?php if ($is_required) {
1886
+    echo 'required_field';
1887
+}
1888
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1779 1889
                 <label>
1780 1890
                     <?php $site_title = __($site_title, 'geodirectory');
1781 1891
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1782
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1892
+                    <?php if ($is_required) {
1893
+    echo '<span>*</span>';
1894
+}
1895
+?>
1783 1896
                 </label>
1784 1897
 
1785 1898
                 <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
@@ -1796,8 +1909,9 @@  discard block
 block discarded – undo
1796 1909
             </div>
1797 1910
         <?php } elseif ($type == 'datepicker') {
1798 1911
 
1799
-            if ($extra_fields['date_format'] == '')
1800
-                $extra_fields['date_format'] = 'yy-mm-dd';
1912
+            if ($extra_fields['date_format'] == '') {
1913
+                            $extra_fields['date_format'] = 'yy-mm-dd';
1914
+            }
1801 1915
 
1802 1916
 
1803 1917
             $search = array('dd', 'mm', 'yy');
@@ -1835,12 +1949,18 @@  discard block
 block discarded – undo
1835 1949
 
1836 1950
             </script>
1837 1951
             <div id="<?php echo $name;?>_row"
1838
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1952
+                 class="<?php if ($is_required) {
1953
+    echo 'required_field';
1954
+}
1955
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1839 1956
                 <label>
1840 1957
 
1841 1958
                     <?php $site_title = __($site_title, 'geodirectory');
1842 1959
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1843
-                    <?php if ($is_required) echo '<span>*</span>';?>
1960
+                    <?php if ($is_required) {
1961
+    echo '<span>*</span>';
1962
+}
1963
+?>
1844 1964
                 </label>
1845 1965
 
1846 1966
                 <input field_type="<?php echo $type;?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -1854,8 +1974,9 @@  discard block
 block discarded – undo
1854 1974
 
1855 1975
         <?php } elseif ($type == 'time') {
1856 1976
 
1857
-            if ($value != '')
1858
-                $value = date('H:i', strtotime($value));
1977
+            if ($value != '') {
1978
+                            $value = date('H:i', strtotime($value));
1979
+            }
1859 1980
             ?>
1860 1981
             <script type="text/javascript">
1861 1982
                 jQuery(document).ready(function () {
@@ -1868,12 +1989,18 @@  discard block
 block discarded – undo
1868 1989
                 });
1869 1990
             </script>
1870 1991
             <div id="<?php echo $name;?>_row"
1871
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1992
+                 class="<?php if ($is_required) {
1993
+    echo 'required_field';
1994
+}
1995
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1872 1996
                 <label>
1873 1997
 
1874 1998
                     <?php $site_title = __($site_title, 'geodirectory');
1875 1999
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1876
-                    <?php if ($is_required) echo '<span>*</span>';?>
2000
+                    <?php if ($is_required) {
2001
+    echo '<span>*</span>';
2002
+}
2003
+?>
1877 2004
                 </label>
1878 2005
                 <input readonly="readonly" field_type="<?php echo $type;?>" name="<?php echo $name;?>"
1879 2006
                        id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
@@ -1889,11 +2016,17 @@  discard block
 block discarded – undo
1889 2016
                 $value = '';
1890 2017
             } ?>
1891 2018
             <div id="<?php echo $name;?>_row"
1892
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2019
+                 class="<?php if ($is_required) {
2020
+    echo 'required_field';
2021
+}
2022
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
1893 2023
                 <label>
1894 2024
                     <?php $site_title = __($site_title, 'geodirectory');
1895 2025
                     echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1896
-                    <?php if ($is_required) echo '<span>*</span>';?>
2026
+                    <?php if ($is_required) {
2027
+    echo '<span>*</span>';
2028
+}
2029
+?>
1897 2030
                 </label>
1898 2031
 
1899 2032
                 <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
@@ -1927,8 +2060,9 @@  discard block
 block discarded – undo
1927 2060
                         $post_cat = implode(",", $post_cat[$name]);
1928 2061
 
1929 2062
                     } else {
1930
-                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1931
-                            $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
2063
+                        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2064
+                                                    $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
2065
+                        }
1932 2066
                     }
1933 2067
 
1934 2068
 
@@ -1966,21 +2100,24 @@  discard block
 block discarded – undo
1966 2100
 
1967 2101
                             $cat_display == '';
1968 2102
                             $multiple = '';
1969
-                            if ($cat_display == 'multiselect')
1970
-                                $multiple = 'multiple="multiple"';
2103
+                            if ($cat_display == 'multiselect') {
2104
+                                                            $multiple = 'multiple="multiple"';
2105
+                            }
1971 2106
 
1972 2107
                             echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1973 2108
 
1974 2109
 
1975
-                            if ($cat_display == 'select')
1976
-                                echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
2110
+                            if ($cat_display == 'select') {
2111
+                                                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
2112
+                            }
1977 2113
 
1978 2114
                         }
1979 2115
 
1980 2116
                         echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1981 2117
 
1982
-                        if ($cat_display == 'select' || $cat_display == 'multiselect')
1983
-                            echo '</select>';
2118
+                        if ($cat_display == 'select' || $cat_display == 'multiselect') {
2119
+                                                    echo '</select>';
2120
+                        }
1984 2121
 
1985 2122
                     } else {
1986 2123
 
@@ -2010,18 +2147,23 @@  discard block
 block discarded – undo
2010 2147
 
2011 2148
                 $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
2012 2149
 
2013
-            } else
2014
-                $file_value = '';
2150
+            } else {
2151
+                            $file_value = '';
2152
+            }
2015 2153
 
2016
-            if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
2017
-                $file_multiple = true; // allow multiple files upload
2018
-            else
2019
-                $file_multiple = false;
2154
+            if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) {
2155
+                            $file_multiple = true;
2156
+            }
2157
+            // allow multiple files upload
2158
+            else {
2159
+                            $file_multiple = false;
2160
+            }
2020 2161
 
2021
-            if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
2022
-                $file_image_limit = $extra_fields['image_limit'];
2023
-            else
2024
-                $file_image_limit = 1;
2162
+            if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) {
2163
+                            $file_image_limit = $extra_fields['image_limit'];
2164
+            } else {
2165
+                            $file_image_limit = 1;
2166
+            }
2025 2167
 
2026 2168
             $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2027 2169
 
@@ -2029,8 +2171,9 @@  discard block
 block discarded – undo
2029 2171
 
2030 2172
             if (!empty($file_value)) {
2031 2173
                 $curImages = explode(',', $file_value);
2032
-                if (!empty($curImages))
2033
-                    $file_totImg = count($curImages);
2174
+                if (!empty($curImages)) {
2175
+                                    $file_totImg = count($curImages);
2176
+                }
2034 2177
             }
2035 2178
 			
2036 2179
 			$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
@@ -2045,12 +2188,18 @@  discard block
 block discarded – undo
2045 2188
             ?>
2046 2189
 
2047 2190
             <div id="<?php echo $name;?>_row"
2048
-                 class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2191
+                 class="<?php if ($is_required) {
2192
+    echo 'required_field';
2193
+}
2194
+?> geodir_form_row clearfix <?php echo $fieldset_field_class;?>">
2049 2195
 
2050 2196
                 <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
2051 2197
                     <label
2052 2198
                         style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
2053
-                        echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
2199
+                        echo $site_title; ?><?php if ($is_required) {
2200
+                            echo '<span>*</span>';
2201
+                        }
2202
+                        ?></label>
2054 2203
                     <input class="geodir-custom-file-upload" field_type="file" type="hidden"
2055 2204
                            name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
2056 2205
                            value="<?php echo esc_attr($file_value); ?>"/>
@@ -2191,9 +2340,10 @@  discard block
 block discarded – undo
2191 2340
             $field_set_start = 0;
2192 2341
 
2193 2342
 
2194
-            if ($fields_location == 'detail')
2195
-
2196
-                $i = 1;
2343
+            if ($fields_location == 'detail') {
2344
+            
2345
+                $i = 1;
2346
+            }
2197 2347
             foreach ($fields_info as $type) {
2198 2348
 				$type = stripslashes_deep($type); // strip slashes
2199 2349
                 $html = '';
@@ -2210,8 +2360,9 @@  discard block
 block discarded – undo
2210 2360
                     $variables_array['post_id'] = $post->ID;
2211 2361
                     $variables_array['label'] = __($type['site_title'], 'geodirectory');
2212 2362
                     $variables_array['value'] = '';
2213
-                    if (isset($post->{$type['htmlvar_name']}))
2214
-                        $variables_array['value'] = $post->{$type['htmlvar_name']};
2363
+                    if (isset($post->{$type['htmlvar_name']})) {
2364
+                                            $variables_array['value'] = $post->{$type['htmlvar_name']};
2365
+                    }
2215 2366
                 endif;
2216 2367
 
2217 2368
                 //if($type['field_icon'])
@@ -2338,8 +2489,9 @@  discard block
 block discarded – undo
2338 2489
                             if ($fields_location == 'detail') {
2339 2490
 
2340 2491
                                 $geodir_odd_even = 'geodir_more_info_odd';
2341
-                                if ($i % 2 == 0)
2342
-                                    $geodir_odd_even = 'geodir_more_info_even';
2492
+                                if ($i % 2 == 0) {
2493
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2494
+                                }
2343 2495
 
2344 2496
                                 $i++;
2345 2497
                             }
@@ -2413,8 +2565,9 @@  discard block
 block discarded – undo
2413 2565
                             if ($fields_location == 'detail') {
2414 2566
 
2415 2567
                                 $geodir_odd_even = 'geodir_more_info_odd';
2416
-                                if ($i % 2 == 0)
2417
-                                    $geodir_odd_even = 'geodir_more_info_even';
2568
+                                if ($i % 2 == 0) {
2569
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2570
+                                }
2418 2571
 
2419 2572
                                 $i++;
2420 2573
                             }
@@ -2456,8 +2609,9 @@  discard block
 block discarded – undo
2456 2609
                             if ($fields_location == 'detail') {
2457 2610
 
2458 2611
                                 $geodir_odd_even = 'geodir_more_info_odd';
2459
-                                if ($i % 2 == 0)
2460
-                                    $geodir_odd_even = 'geodir_more_info_even';
2612
+                                if ($i % 2 == 0) {
2613
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2614
+                                }
2461 2615
 
2462 2616
                                 $i++;
2463 2617
                             }
@@ -2477,9 +2631,10 @@  discard block
 block discarded – undo
2477 2631
                         if ($post->{$type['htmlvar_name']}):
2478 2632
 
2479 2633
                             $value = '';
2480
-                            if ($post->{$type['htmlvar_name']} != '')
2481
-                                //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
2482
-                                $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2634
+                            if ($post->{$type['htmlvar_name']} != '') {
2635
+                                                            //$value = date('h:i',strtotime($post->{$type['htmlvar_name']}));
2636
+                                $value = date(get_option('time_format'), strtotime($post->{$type['htmlvar_name']}));
2637
+                            }
2483 2638
 
2484 2639
                             if (strpos($field_icon, 'http') !== false) {
2485 2640
                                 $field_icon_af = '';
@@ -2494,8 +2649,9 @@  discard block
 block discarded – undo
2494 2649
                             if ($fields_location == 'detail') {
2495 2650
 
2496 2651
                                 $geodir_odd_even = 'geodir_more_info_odd';
2497
-                                if ($i % 2 == 0)
2498
-                                    $geodir_odd_even = 'geodir_more_info_even';
2652
+                                if ($i % 2 == 0) {
2653
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2654
+                                }
2499 2655
 
2500 2656
                                 $i++;
2501 2657
                             }
@@ -2528,7 +2684,7 @@  discard block
 block discarded – undo
2528 2684
                             $value = '';
2529 2685
                             if ($post->{$type['htmlvar_name']} != '' && $post->{$type['htmlvar_name']}!="0000-00-00") {
2530 2686
                                 $value = date($date_format, strtotime($post_htmlvar_value));
2531
-                            }else{
2687
+                            } else{
2532 2688
                                 continue;
2533 2689
                             }
2534 2690
 
@@ -2545,8 +2701,9 @@  discard block
 block discarded – undo
2545 2701
                             if ($fields_location == 'detail') {
2546 2702
 
2547 2703
                                 $geodir_odd_even = 'geodir_more_info_odd';
2548
-                                if ($i % 2 == 0)
2549
-                                    $geodir_odd_even = 'geodir_more_info_even';
2704
+                                if ($i % 2 == 0) {
2705
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2706
+                                }
2550 2707
 
2551 2708
                                 $i++;
2552 2709
                             }
@@ -2578,8 +2735,9 @@  discard block
 block discarded – undo
2578 2735
                             if ($fields_location == 'detail') {
2579 2736
 
2580 2737
                                 $geodir_odd_even = 'geodir_more_info_odd';
2581
-                                if ($i % 2 == 0)
2582
-                                    $geodir_odd_even = 'geodir_more_info_even';
2738
+                                if ($i % 2 == 0) {
2739
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2740
+                                }
2583 2741
 
2584 2742
                                 $i++;
2585 2743
                             }
@@ -2603,8 +2761,9 @@  discard block
 block discarded – undo
2603 2761
                             if ($fields_location == 'detail') {
2604 2762
 
2605 2763
                                 $geodir_odd_even = 'geodir_more_info_odd';
2606
-                                if ($i % 2 == 0)
2607
-                                    $geodir_odd_even = 'geodir_more_info_even';
2764
+                                if ($i % 2 == 0) {
2765
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2766
+                                }
2608 2767
 
2609 2768
                                 $i++;
2610 2769
                             }
@@ -2654,8 +2813,9 @@  discard block
 block discarded – undo
2654 2813
                             if ($fields_location == 'detail') {
2655 2814
 
2656 2815
                                 $geodir_odd_even = 'geodir_more_info_odd';
2657
-                                if ($i % 2 == 0)
2658
-                                    $geodir_odd_even = 'geodir_more_info_even';
2816
+                                if ($i % 2 == 0) {
2817
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2818
+                                }
2659 2819
 
2660 2820
                                 $i++;
2661 2821
                             }
@@ -2675,8 +2835,10 @@  discard block
 block discarded – undo
2675 2835
 
2676 2836
                             if ($post->{$type['htmlvar_name']} == '1'):
2677 2837
                                 $html_val = __('Yes', 'geodirectory');
2678
-                            else:
2679
-                                $html_val = __('No', 'geodirectory');
2838
+                            else {
2839
+                                :
2840
+                                $html_val = __('No', 'geodirectory');
2841
+                            }
2680 2842
                             endif;
2681 2843
 
2682 2844
                             if (strpos($field_icon, 'http') !== false) {
@@ -2692,8 +2854,9 @@  discard block
 block discarded – undo
2692 2854
                             if ($fields_location == 'detail') {
2693 2855
 
2694 2856
                                 $geodir_odd_even = 'geodir_more_info_odd';
2695
-                                if ($i % 2 == 0)
2696
-                                    $geodir_odd_even = 'geodir_more_info_even';
2857
+                                if ($i % 2 == 0) {
2858
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2859
+                                }
2697 2860
 
2698 2861
                                 $i++;
2699 2862
                             }
@@ -2737,8 +2900,9 @@  discard block
 block discarded – undo
2737 2900
                             if ($fields_location == 'detail') {
2738 2901
 
2739 2902
                                 $geodir_odd_even = 'geodir_more_info_odd';
2740
-                                if ($i % 2 == 0)
2741
-                                    $geodir_odd_even = 'geodir_more_info_even';
2903
+                                if ($i % 2 == 0) {
2904
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2905
+                                }
2742 2906
 
2743 2907
                                 $i++;
2744 2908
                             }
@@ -2789,8 +2953,9 @@  discard block
 block discarded – undo
2789 2953
                             if ($fields_location == 'detail') {
2790 2954
 
2791 2955
                                 $geodir_odd_even = 'geodir_more_info_odd';
2792
-                                if ($i % 2 == 0)
2793
-                                    $geodir_odd_even = 'geodir_more_info_even';
2956
+                                if ($i % 2 == 0) {
2957
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
2958
+                                }
2794 2959
 
2795 2960
                                 $i++;
2796 2961
                             }
@@ -2844,8 +3009,9 @@  discard block
 block discarded – undo
2844 3009
                             if ($fields_location == 'detail') {
2845 3010
 
2846 3011
                                 $geodir_odd_even = 'geodir_more_info_odd';
2847
-                                if ($i % 2 == 0)
2848
-                                    $geodir_odd_even = 'geodir_more_info_even';
3012
+                                if ($i % 2 == 0) {
3013
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
3014
+                                }
2849 3015
 
2850 3016
                                 $i++;
2851 3017
                             }
@@ -2890,8 +3056,9 @@  discard block
 block discarded – undo
2890 3056
                                 if ($fields_location == 'detail') {
2891 3057
 
2892 3058
                                     $geodir_odd_even = 'geodir_more_info_odd';
2893
-                                    if ($i % 2 == 0)
2894
-                                        $geodir_odd_even = 'geodir_more_info_even';
3059
+                                    if ($i % 2 == 0) {
3060
+                                                                            $geodir_odd_even = 'geodir_more_info_even';
3061
+                                    }
2895 3062
 
2896 3063
                                     $i++;
2897 3064
                                 }
@@ -2911,7 +3078,7 @@  discard block
 block discarded – undo
2911 3078
                                      */
2912 3079
                                     $email_name = apply_filters('geodir_email_field_name_output',$email,$type);
2913 3080
                                     $html .=  "<script>document.write('<a href=\"mailto:'+'$e_split[0]' + '@' + '$e_split[1]'+'\">$email_name</a>')</script>";
2914
-                                }else{
3081
+                                } else{
2915 3082
                                     $html .=  $email;
2916 3083
                                 }
2917 3084
                                 $html .= '</span></div>';
@@ -2989,8 +3156,9 @@  discard block
 block discarded – undo
2989 3156
                                 if ($fields_location == 'detail') {
2990 3157
 
2991 3158
                                     $geodir_odd_even = 'geodir_more_info_odd';
2992
-                                    if ($i % 2 == 0)
2993
-                                        $geodir_odd_even = 'geodir_more_info_even';
3159
+                                    if ($i % 2 == 0) {
3160
+                                                                            $geodir_odd_even = 'geodir_more_info_even';
3161
+                                    }
2994 3162
 
2995 3163
                                     $i++;
2996 3164
                                 }
@@ -3024,8 +3192,9 @@  discard block
 block discarded – undo
3024 3192
                             if ($fields_location == 'detail') {
3025 3193
 
3026 3194
                                 $geodir_odd_even = 'geodir_more_info_odd';
3027
-                                if ($i % 2 == 0)
3028
-                                    $geodir_odd_even = 'geodir_more_info_even';
3195
+                                if ($i % 2 == 0) {
3196
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
3197
+                                }
3029 3198
 
3030 3199
                                 $i++;
3031 3200
                             }
@@ -3053,8 +3222,9 @@  discard block
 block discarded – undo
3053 3222
                             if ($fields_location == 'detail') {
3054 3223
 
3055 3224
                                 $geodir_odd_even = 'geodir_more_info_odd';
3056
-                                if ($i % 2 == 0)
3057
-                                    $geodir_odd_even = 'geodir_more_info_even';
3225
+                                if ($i % 2 == 0) {
3226
+                                                                    $geodir_odd_even = 'geodir_more_info_even';
3227
+                                }
3058 3228
 
3059 3229
                                 $i++;
3060 3230
                             }
@@ -3149,7 +3319,9 @@  discard block
 block discarded – undo
3149 3319
                      * @param string $html Custom field unfiltered HTML.
3150 3320
                      * @param array $variables_array Custom field variables array.
3151 3321
                      */
3152
-                    if ($html) echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
3322
+                    if ($html) {
3323
+                        echo apply_filters("geodir_show_{$html_var}", $html, $variables_array);
3324
+                    }
3153 3325
 
3154 3326
                     /**
3155 3327
                      * Called after a custom fields is output on the frontend.
@@ -3183,10 +3355,11 @@  discard block
 block discarded – undo
3183 3355
 	 */
3184 3356
 	function geodir_default_date_format()
3185 3357
     {
3186
-        if ($format = get_option('date_format'))
3187
-            return $format;
3188
-        else
3189
-            return 'dd-mm-yy';
3358
+        if ($format = get_option('date_format')) {
3359
+                    return $format;
3360
+        } else {
3361
+                    return 'dd-mm-yy';
3362
+        }
3190 3363
     }
3191 3364
 }
3192 3365
 
@@ -3293,11 +3466,13 @@  discard block
 block discarded – undo
3293 3466
                     // Set an array containing a list of acceptable formats
3294 3467
                     //$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/octet-stream', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
3295 3468
 
3296
-					if (!function_exists('wp_handle_upload'))
3297
-						require_once(ABSPATH . 'wp-admin/includes/file.php');
3469
+					if (!function_exists('wp_handle_upload')) {
3470
+											require_once(ABSPATH . 'wp-admin/includes/file.php');
3471
+					}
3298 3472
 
3299
-					if (!is_dir($geodir_uploadpath))
3300
-						mkdir($geodir_uploadpath);
3473
+					if (!is_dir($geodir_uploadpath)) {
3474
+											mkdir($geodir_uploadpath);
3475
+					}
3301 3476
 
3302 3477
 					$new_name = $post_id . '_' . $field_id . '_' . $img_name_arr[0] . '.' . $img_name_arr[1];
3303 3478
 					$explode_sub_dir = explode("/", $sub_dir);
@@ -3310,16 +3485,19 @@  discard block
 block discarded – undo
3310 3485
 					}
3311 3486
 
3312 3487
 					$uploaded_file = '';
3313
-					if (file_exists($img_path))
3314
-						$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3488
+					if (file_exists($img_path)) {
3489
+											$uploaded_file = copy($img_path, $geodir_uploadpath . '/' . $new_name);
3490
+					}
3315 3491
 
3316 3492
 					if ($curr_img_dir != $geodir_uploaddir) {
3317
-						if (file_exists($img_path))
3318
-							unlink($img_path);
3493
+						if (file_exists($img_path)) {
3494
+													unlink($img_path);
3495
+						}
3319 3496
 					}
3320 3497
 
3321
-					if (!empty($uploaded_file))
3322
-						$file_urls = $geodir_uploadurl . '/' . $new_name;
3498
+					if (!empty($uploaded_file)) {
3499
+											$file_urls = $geodir_uploadurl . '/' . $new_name;
3500
+					}
3323 3501
 
3324 3502
                 } else {
3325 3503
                     $file_urls = $post_image[$m];
@@ -3340,8 +3518,9 @@  discard block
 block discarded – undo
3340 3518
 
3341 3519
         geodir_save_post_meta($post_id, $field_id, $file_urls);
3342 3520
 
3343
-        if (!empty($invalid_files))
3344
-            geodir_remove_attachments($invalid_files);
3521
+        if (!empty($invalid_files)) {
3522
+                    geodir_remove_attachments($invalid_files);
3523
+        }
3345 3524
 
3346 3525
     }
3347 3526
 }
@@ -3567,8 +3746,9 @@  discard block
 block discarded – undo
3567 3746
 
3568 3747
         $all_postypes = geodir_get_posttypes();
3569 3748
 
3570
-        if (!in_array($post_type, $all_postypes))
3571
-            return false;
3749
+        if (!in_array($post_type, $all_postypes)) {
3750
+                    return false;
3751
+        }
3572 3752
 
3573 3753
         $fields = array();
3574 3754
 
@@ -3656,8 +3836,10 @@  discard block
 block discarded – undo
3656 3836
         }
3657 3837
 
3658 3838
         return $field_ids;
3659
-    else:
3660
-        return false;
3839
+    else {
3840
+        :
3841
+        return false;
3842
+    }
3661 3843
     endif;
3662 3844
 }
3663 3845
 
@@ -3830,8 +4012,9 @@  discard block
 block discarded – undo
3830 4012
 
3831 4013
             return $field_id;
3832 4014
 
3833
-        } else
3834
-            return 0;
4015
+        } else {
4016
+                    return 0;
4017
+        }
3835 4018
 
3836 4019
     }
3837 4020
 }
@@ -3873,8 +4056,9 @@  discard block
 block discarded – undo
3873 4056
         $htmlvar_name = isset($field_types[1]) ? $field_types[1] : '';
3874 4057
 
3875 4058
         $site_title = '';
3876
-        if ($site_title == '')
3877
-            $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
4059
+        if ($site_title == '') {
4060
+                    $site_title = isset($field_info->site_title) ? $field_info->site_title : '';
4061
+        }
3878 4062
 
3879 4063
         if ($site_title == '') {
3880 4064
             $fields = geodir_get_custom_sort_options($post_type);
@@ -3888,8 +4072,9 @@  discard block
 block discarded – undo
3888 4072
             }
3889 4073
         }
3890 4074
 
3891
-        if ($htmlvar_name == '')
3892
-            $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
4075
+        if ($htmlvar_name == '') {
4076
+                    $htmlvar_name = isset($field_info->htmlvar_name) ? $field_info->htmlvar_name : '';
4077
+        }
3893 4078
 
3894 4079
         $nonce = wp_create_nonce('custom_fields_' . $result_str);
3895 4080
         
Please login to merge, or discard this patch.