Test Setup Failed
Pull Request — master (#215)
by Viruthagiri
12:15
created
tests/test-Register.php 2 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -1,89 +1,89 @@
 block discarded – undo
1 1
 <?php
2 2
 class Register extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-        wp_set_current_user(0);
8
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+		wp_set_current_user(0);
8
+	}
9 9
 
10
-    public function test_register_empty_username() {
11
-        $errors = geodir_register_new_user(
12
-            '',
13
-            '[email protected]'
14
-        );
15
-        $errors = (array) $errors;
16
-        $this->assertArrayHasKey( 'empty_username', $errors["errors"] );
17
-        $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] );
18
-    }
10
+	public function test_register_empty_username() {
11
+		$errors = geodir_register_new_user(
12
+			'',
13
+			'[email protected]'
14
+		);
15
+		$errors = (array) $errors;
16
+		$this->assertArrayHasKey( 'empty_username', $errors["errors"] );
17
+		$this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] );
18
+	}
19 19
 
20
-    public function test_register_invalid_username() {
21
-        $errors = geodir_register_new_user(
22
-            '@#$%^',
23
-            '[email protected]'
24
-        );
25
-        $errors = (array) $errors;
26
-        $this->assertArrayHasKey( 'invalid_username', $errors["errors"] );
27
-        $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] );
28
-    }
20
+	public function test_register_invalid_username() {
21
+		$errors = geodir_register_new_user(
22
+			'@#$%^',
23
+			'[email protected]'
24
+		);
25
+		$errors = (array) $errors;
26
+		$this->assertArrayHasKey( 'invalid_username', $errors["errors"] );
27
+		$this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] );
28
+	}
29 29
 
30
-    public function test_register_invalid_email() {
31
-        $errors = geodir_register_new_user(
32
-            'hello',
33
-            'hello@@hi.com'
34
-        );
35
-        $errors = (array) $errors;
36
-        $this->assertArrayHasKey( 'invalid_email', $errors["errors"] );
37
-        $this->assertContains( 'The email address isn&#8217;t correct', $errors["errors"]["invalid_email"][0] );
38
-    }
30
+	public function test_register_invalid_email() {
31
+		$errors = geodir_register_new_user(
32
+			'hello',
33
+			'hello@@hi.com'
34
+		);
35
+		$errors = (array) $errors;
36
+		$this->assertArrayHasKey( 'invalid_email', $errors["errors"] );
37
+		$this->assertContains( 'The email address isn&#8217;t correct', $errors["errors"]["invalid_email"][0] );
38
+	}
39 39
 
40
-    public function test_register_empty_email() {
41
-        $errors = geodir_register_new_user(
42
-            'hello',
43
-            ''
44
-        );
45
-        $errors = (array) $errors;
46
-        $this->assertArrayHasKey( 'empty_email', $errors["errors"] );
47
-        $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] );
48
-    }
40
+	public function test_register_empty_email() {
41
+		$errors = geodir_register_new_user(
42
+			'hello',
43
+			''
44
+		);
45
+		$errors = (array) $errors;
46
+		$this->assertArrayHasKey( 'empty_email', $errors["errors"] );
47
+		$this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] );
48
+	}
49 49
 
50
-    public function test_register_invalid_password() {
51
-        update_option('geodir_allow_cpass', 1);
52
-        $_REQUEST['user_pass'] = '12345';
53
-        $_REQUEST['user_pass2'] = '1234';
54
-        $_POST['user_fname'] = 'Test User';
55
-        $errors = geodir_register_new_user(
56
-            'hello',
57
-            '[email protected]'
58
-        );
59
-        $errors = (array) $errors;
60
-        $this->assertArrayHasKey( 'pass_match', $errors["errors"] );
61
-        $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] );
50
+	public function test_register_invalid_password() {
51
+		update_option('geodir_allow_cpass', 1);
52
+		$_REQUEST['user_pass'] = '12345';
53
+		$_REQUEST['user_pass2'] = '1234';
54
+		$_POST['user_fname'] = 'Test User';
55
+		$errors = geodir_register_new_user(
56
+			'hello',
57
+			'[email protected]'
58
+		);
59
+		$errors = (array) $errors;
60
+		$this->assertArrayHasKey( 'pass_match', $errors["errors"] );
61
+		$this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] );
62 62
 
63
-        $_REQUEST['user_pass'] = '12345';
64
-        $_REQUEST['user_pass2'] = '12345';
65
-        $errors = geodir_register_new_user(
66
-            'hello',
67
-            '[email protected]'
68
-        );
69
-        $errors = (array) $errors;
70
-        $this->assertArrayHasKey( 'pass_match', $errors["errors"] );
71
-        $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] );
72
-    }
63
+		$_REQUEST['user_pass'] = '12345';
64
+		$_REQUEST['user_pass2'] = '12345';
65
+		$errors = geodir_register_new_user(
66
+			'hello',
67
+			'[email protected]'
68
+		);
69
+		$errors = (array) $errors;
70
+		$this->assertArrayHasKey( 'pass_match', $errors["errors"] );
71
+		$this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] );
72
+	}
73 73
 
74
-    public function test_register_success() {
75
-        $_POST['user_fname'] = 'Test User';
76
-        $data = geodir_register_new_user(
77
-            'hello',
78
-            '[email protected]'
79
-        );
80
-        $this->assertInternalType("int", $data[0]);
81
-    }
74
+	public function test_register_success() {
75
+		$_POST['user_fname'] = 'Test User';
76
+		$data = geodir_register_new_user(
77
+			'hello',
78
+			'[email protected]'
79
+		);
80
+		$this->assertInternalType("int", $data[0]);
81
+	}
82 82
 
83
-    public function tearDown()
84
-    {
85
-        parent::tearDown();
86
-    }
83
+	public function tearDown()
84
+	{
85
+		parent::tearDown();
86
+	}
87 87
 
88 88
 }
89 89
 ?>
90 90
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
             '[email protected]'
14 14
         );
15 15
         $errors = (array) $errors;
16
-        $this->assertArrayHasKey( 'empty_username', $errors["errors"] );
17
-        $this->assertContains( 'Please enter a username', $errors["errors"]["empty_username"][0] );
16
+        $this->assertArrayHasKey('empty_username', $errors["errors"]);
17
+        $this->assertContains('Please enter a username', $errors["errors"]["empty_username"][0]);
18 18
     }
19 19
 
20 20
     public function test_register_invalid_username() {
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
             '[email protected]'
24 24
         );
25 25
         $errors = (array) $errors;
26
-        $this->assertArrayHasKey( 'invalid_username', $errors["errors"] );
27
-        $this->assertContains( 'This username is invalid', $errors["errors"]["invalid_username"][0] );
26
+        $this->assertArrayHasKey('invalid_username', $errors["errors"]);
27
+        $this->assertContains('This username is invalid', $errors["errors"]["invalid_username"][0]);
28 28
     }
29 29
 
30 30
     public function test_register_invalid_email() {
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
             'hello@@hi.com'
34 34
         );
35 35
         $errors = (array) $errors;
36
-        $this->assertArrayHasKey( 'invalid_email', $errors["errors"] );
37
-        $this->assertContains( 'The email address isn&#8217;t correct', $errors["errors"]["invalid_email"][0] );
36
+        $this->assertArrayHasKey('invalid_email', $errors["errors"]);
37
+        $this->assertContains('The email address isn&#8217;t correct', $errors["errors"]["invalid_email"][0]);
38 38
     }
39 39
 
40 40
     public function test_register_empty_email() {
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
             ''
44 44
         );
45 45
         $errors = (array) $errors;
46
-        $this->assertArrayHasKey( 'empty_email', $errors["errors"] );
47
-        $this->assertContains( 'Please type your e-mail address', $errors["errors"]["empty_email"][0] );
46
+        $this->assertArrayHasKey('empty_email', $errors["errors"]);
47
+        $this->assertContains('Please type your e-mail address', $errors["errors"]["empty_email"][0]);
48 48
     }
49 49
 
50 50
     public function test_register_invalid_password() {
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
             '[email protected]'
58 58
         );
59 59
         $errors = (array) $errors;
60
-        $this->assertArrayHasKey( 'pass_match', $errors["errors"] );
61
-        $this->assertContains( 'Passwords do not match', $errors["errors"]["pass_match"][0] );
60
+        $this->assertArrayHasKey('pass_match', $errors["errors"]);
61
+        $this->assertContains('Passwords do not match', $errors["errors"]["pass_match"][0]);
62 62
 
63 63
         $_REQUEST['user_pass'] = '12345';
64 64
         $_REQUEST['user_pass2'] = '12345';
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
             '[email protected]'
68 68
         );
69 69
         $errors = (array) $errors;
70
-        $this->assertArrayHasKey( 'pass_match', $errors["errors"] );
71
-        $this->assertContains( 'Password must be 7 characters or more', $errors["errors"]["pass_match"][0] );
70
+        $this->assertArrayHasKey('pass_match', $errors["errors"]);
71
+        $this->assertContains('Password must be 7 characters or more', $errors["errors"]["pass_match"][0]);
72 72
     }
73 73
 
74 74
     public function test_register_success() {
Please login to merge, or discard this patch.
tests/test-Add_Custom_Fields.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -1,76 +1,76 @@
 block discarded – undo
1 1
 <?php
2 2
 class AddCustomFields extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+	}
8 8
 
9
-    public function testAddCustomFields()
10
-    {
11
-        $field = array(
12
-            'listing_type'  => 'gd_place',
13
-            'data_type'     => '',
14
-            'field_type'    => 'select',
15
-            'admin_title'   => __( 'Place Type', 'test' ),
16
-            'admin_desc'    => __( 'Select the place type.', 'test' ),
17
-            'site_title'    => __( 'Place Type', 'test' ),
18
-            'htmlvar_name'  => 'test_place_type',
19
-            'default_value' => '',
20
-            'option_values' => 'Hotel,Bar,Restaurant,Pub',
21
-            'is_default'    => '1',
22
-            'is_admin'      => '1',
23
-            'clabels'       => __( 'Place Type', 'test' )
24
-        );
9
+	public function testAddCustomFields()
10
+	{
11
+		$field = array(
12
+			'listing_type'  => 'gd_place',
13
+			'data_type'     => '',
14
+			'field_type'    => 'select',
15
+			'admin_title'   => __( 'Place Type', 'test' ),
16
+			'admin_desc'    => __( 'Select the place type.', 'test' ),
17
+			'site_title'    => __( 'Place Type', 'test' ),
18
+			'htmlvar_name'  => 'test_place_type',
19
+			'default_value' => '',
20
+			'option_values' => 'Hotel,Bar,Restaurant,Pub',
21
+			'is_default'    => '1',
22
+			'is_admin'      => '1',
23
+			'clabels'       => __( 'Place Type', 'test' )
24
+		);
25 25
 
26
-        $lastid = geodir_custom_field_save( $field );
26
+		$lastid = geodir_custom_field_save( $field );
27 27
 
28
-        $this->assertTrue(is_int($lastid));
28
+		$this->assertTrue(is_int($lastid));
29 29
 
30 30
 
31
-        $field2 = array(
32
-            'listing_type'  => 'gd_place',
33
-            'data_type'     => 'VARCHAR',
34
-            'field_type'    => 'url',
35
-            'admin_title'   => __( 'Website Link', 'test' ),
36
-            'admin_desc'    => __( 'Enter the website link.', 'test' ),
37
-            'site_title'    => __( 'Website Link', 'test' ),
38
-            'htmlvar_name'  => 'test_ws_link',
39
-            'default_value' => '',
40
-            'option_values' => '',
41
-            'is_default'    => '1',
42
-            'is_admin'      => '1',
43
-            'clabels'       => __( 'Website Link', 'test' )
44
-        );
31
+		$field2 = array(
32
+			'listing_type'  => 'gd_place',
33
+			'data_type'     => 'VARCHAR',
34
+			'field_type'    => 'url',
35
+			'admin_title'   => __( 'Website Link', 'test' ),
36
+			'admin_desc'    => __( 'Enter the website link.', 'test' ),
37
+			'site_title'    => __( 'Website Link', 'test' ),
38
+			'htmlvar_name'  => 'test_ws_link',
39
+			'default_value' => '',
40
+			'option_values' => '',
41
+			'is_default'    => '1',
42
+			'is_admin'      => '1',
43
+			'clabels'       => __( 'Website Link', 'test' )
44
+		);
45 45
 
46
-        $lastid2 = geodir_custom_field_save( $field2 );
46
+		$lastid2 = geodir_custom_field_save( $field2 );
47 47
 
48
-        $this->assertTrue(is_int($lastid2));
48
+		$this->assertTrue(is_int($lastid2));
49 49
 
50
-        //test error
51
-        $field3 = array(
52
-            'listing_type'  => 'gd_place',
53
-            'data_type'     => '',
54
-            'field_type'    => 'select',
55
-            'admin_title'   => __( 'Place Type', 'test' ),
56
-            'admin_desc'    => __( 'Select the place type.', 'test' ),
57
-            'site_title'    => __( 'Place Type', 'test' ),
58
-            'htmlvar_name'  => 'test_place_type',
59
-            'default_value' => '',
60
-            'option_values' => 'Hotel,Bar,Restaurant,Pub',
61
-            'is_default'    => '1',
62
-            'is_admin'      => '1',
63
-            'clabels'       => __( 'Place Type', 'test' )
64
-        );
50
+		//test error
51
+		$field3 = array(
52
+			'listing_type'  => 'gd_place',
53
+			'data_type'     => '',
54
+			'field_type'    => 'select',
55
+			'admin_title'   => __( 'Place Type', 'test' ),
56
+			'admin_desc'    => __( 'Select the place type.', 'test' ),
57
+			'site_title'    => __( 'Place Type', 'test' ),
58
+			'htmlvar_name'  => 'test_place_type',
59
+			'default_value' => '',
60
+			'option_values' => 'Hotel,Bar,Restaurant,Pub',
61
+			'is_default'    => '1',
62
+			'is_admin'      => '1',
63
+			'clabels'       => __( 'Place Type', 'test' )
64
+		);
65 65
 
66
-        $error = geodir_custom_field_save( $field3 );
66
+		$error = geodir_custom_field_save( $field3 );
67 67
 
68
-        $this->assertContains( 'HTML Variable Name should be a unique name', $error );
69
-    }
68
+		$this->assertContains( 'HTML Variable Name should be a unique name', $error );
69
+	}
70 70
 
71
-    public function tearDown()
72
-    {
73
-        parent::tearDown();
74
-    }
71
+	public function tearDown()
72
+	{
73
+		parent::tearDown();
74
+	}
75 75
 }
76 76
 ?>
77 77
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,18 +12,18 @@  discard block
 block discarded – undo
12 12
             'listing_type'  => 'gd_place',
13 13
             'data_type'     => '',
14 14
             'field_type'    => 'select',
15
-            'admin_title'   => __( 'Place Type', 'test' ),
16
-            'admin_desc'    => __( 'Select the place type.', 'test' ),
17
-            'site_title'    => __( 'Place Type', 'test' ),
15
+            'admin_title'   => __('Place Type', 'test'),
16
+            'admin_desc'    => __('Select the place type.', 'test'),
17
+            'site_title'    => __('Place Type', 'test'),
18 18
             'htmlvar_name'  => 'test_place_type',
19 19
             'default_value' => '',
20 20
             'option_values' => 'Hotel,Bar,Restaurant,Pub',
21 21
             'is_default'    => '1',
22 22
             'is_admin'      => '1',
23
-            'clabels'       => __( 'Place Type', 'test' )
23
+            'clabels'       => __('Place Type', 'test')
24 24
         );
25 25
 
26
-        $lastid = geodir_custom_field_save( $field );
26
+        $lastid = geodir_custom_field_save($field);
27 27
 
28 28
         $this->assertTrue(is_int($lastid));
29 29
 
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
             'listing_type'  => 'gd_place',
33 33
             'data_type'     => 'VARCHAR',
34 34
             'field_type'    => 'url',
35
-            'admin_title'   => __( 'Website Link', 'test' ),
36
-            'admin_desc'    => __( 'Enter the website link.', 'test' ),
37
-            'site_title'    => __( 'Website Link', 'test' ),
35
+            'admin_title'   => __('Website Link', 'test'),
36
+            'admin_desc'    => __('Enter the website link.', 'test'),
37
+            'site_title'    => __('Website Link', 'test'),
38 38
             'htmlvar_name'  => 'test_ws_link',
39 39
             'default_value' => '',
40 40
             'option_values' => '',
41 41
             'is_default'    => '1',
42 42
             'is_admin'      => '1',
43
-            'clabels'       => __( 'Website Link', 'test' )
43
+            'clabels'       => __('Website Link', 'test')
44 44
         );
45 45
 
46
-        $lastid2 = geodir_custom_field_save( $field2 );
46
+        $lastid2 = geodir_custom_field_save($field2);
47 47
 
48 48
         $this->assertTrue(is_int($lastid2));
49 49
 
@@ -52,20 +52,20 @@  discard block
 block discarded – undo
52 52
             'listing_type'  => 'gd_place',
53 53
             'data_type'     => '',
54 54
             'field_type'    => 'select',
55
-            'admin_title'   => __( 'Place Type', 'test' ),
56
-            'admin_desc'    => __( 'Select the place type.', 'test' ),
57
-            'site_title'    => __( 'Place Type', 'test' ),
55
+            'admin_title'   => __('Place Type', 'test'),
56
+            'admin_desc'    => __('Select the place type.', 'test'),
57
+            'site_title'    => __('Place Type', 'test'),
58 58
             'htmlvar_name'  => 'test_place_type',
59 59
             'default_value' => '',
60 60
             'option_values' => 'Hotel,Bar,Restaurant,Pub',
61 61
             'is_default'    => '1',
62 62
             'is_admin'      => '1',
63
-            'clabels'       => __( 'Place Type', 'test' )
63
+            'clabels'       => __('Place Type', 'test')
64 64
         );
65 65
 
66
-        $error = geodir_custom_field_save( $field3 );
66
+        $error = geodir_custom_field_save($field3);
67 67
 
68
-        $this->assertContains( 'HTML Variable Name should be a unique name', $error );
68
+        $this->assertContains('HTML Variable Name should be a unique name', $error);
69 69
     }
70 70
 
71 71
     public function tearDown()
Please login to merge, or discard this patch.
tests/test-Check_Notifications.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -1,92 +1,92 @@
 block discarded – undo
1 1
 <?php
2 2
 class CheckNotifications extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+	}
8 8
 
9
-    public function testSendFriendEmail()
10
-    {
11
-        add_filter('wp_mail', 'print_mail');
12
-        ob_start();
13
-        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_friend');
14
-        $output = ob_get_clean();
15
-        remove_filter('wp_mail', 'print_mail');
16
-        $this->assertContains( 'thought you might be interested in', $output );
17
-        $this->assertContains( 'Your friend has sent you a message from', $output );
18
-        $this->assertContains( '[email protected]', $output );
19
-        $this->assertContains( 'ADMIN BCC COPY', $output );
20
-    }
9
+	public function testSendFriendEmail()
10
+	{
11
+		add_filter('wp_mail', 'print_mail');
12
+		ob_start();
13
+		geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_friend');
14
+		$output = ob_get_clean();
15
+		remove_filter('wp_mail', 'print_mail');
16
+		$this->assertContains( 'thought you might be interested in', $output );
17
+		$this->assertContains( 'Your friend has sent you a message from', $output );
18
+		$this->assertContains( '[email protected]', $output );
19
+		$this->assertContains( 'ADMIN BCC COPY', $output );
20
+	}
21 21
 
22
-    public function testSendEnquiryEmail()
23
-    {
24
-        add_filter('wp_mail', 'print_mail');
25
-        ob_start();
26
-        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_enquiry');
27
-        $output = ob_get_clean();
28
-        remove_filter('wp_mail', 'print_mail');
29
-        $this->assertContains( 'Website Enquiry', $output );
30
-        $this->assertContains( 'An enquiry has been sent from', $output );
31
-        $this->assertContains( '[email protected]', $output );
32
-        $this->assertContains( 'ADMIN BCC COPY', $output );
33
-    }
22
+	public function testSendEnquiryEmail()
23
+	{
24
+		add_filter('wp_mail', 'print_mail');
25
+		ob_start();
26
+		geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_enquiry');
27
+		$output = ob_get_clean();
28
+		remove_filter('wp_mail', 'print_mail');
29
+		$this->assertContains( 'Website Enquiry', $output );
30
+		$this->assertContains( 'An enquiry has been sent from', $output );
31
+		$this->assertContains( '[email protected]', $output );
32
+		$this->assertContains( 'ADMIN BCC COPY', $output );
33
+	}
34 34
 
35
-    public function testForgotPassEmail()
36
-    {
37
-        add_filter('wp_mail', 'print_mail');
38
-        ob_start();
39
-        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'forgot_password');
40
-        $output = ob_get_clean();
41
-        remove_filter('wp_mail', 'print_mail');
42
-        $this->assertContains( 'Your new password', $output );
43
-        $this->assertContains( 'You requested a new password for', $output );
44
-        $this->assertContains( '[email protected]', $output );
45
-    }
35
+	public function testForgotPassEmail()
36
+	{
37
+		add_filter('wp_mail', 'print_mail');
38
+		ob_start();
39
+		geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'forgot_password');
40
+		$output = ob_get_clean();
41
+		remove_filter('wp_mail', 'print_mail');
42
+		$this->assertContains( 'Your new password', $output );
43
+		$this->assertContains( 'You requested a new password for', $output );
44
+		$this->assertContains( '[email protected]', $output );
45
+	}
46 46
 
47
-    public function testRegistrationEmail()
48
-    {
49
-        add_filter('wp_mail', 'print_mail');
50
-        ob_start();
51
-        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'registration');
52
-        $output = ob_get_clean();
53
-        remove_filter('wp_mail', 'print_mail');
54
-        $this->assertContains( 'Your Log In Details', $output );
55
-        $this->assertContains( 'You can log in  with the following information', $output );
56
-        $this->assertContains( '[email protected]', $output );
57
-        $this->assertContains( 'ADMIN BCC COPY', $output );
58
-    }
47
+	public function testRegistrationEmail()
48
+	{
49
+		add_filter('wp_mail', 'print_mail');
50
+		ob_start();
51
+		geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'registration');
52
+		$output = ob_get_clean();
53
+		remove_filter('wp_mail', 'print_mail');
54
+		$this->assertContains( 'Your Log In Details', $output );
55
+		$this->assertContains( 'You can log in  with the following information', $output );
56
+		$this->assertContains( '[email protected]', $output );
57
+		$this->assertContains( 'ADMIN BCC COPY', $output );
58
+	}
59 59
 
60
-    public function testPostSubmitEmail()
61
-    {
62
-        add_filter('wp_mail', 'print_mail');
63
-        ob_start();
64
-        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'post_submit');
65
-        $output = ob_get_clean();
66
-        remove_filter('wp_mail', 'print_mail');
67
-        $this->assertContains( 'Post Submitted Successfully', $output );
68
-        $this->assertContains( 'You submitted the below listing information', $output );
69
-        $this->assertContains( '[email protected]', $output );
70
-        $this->assertContains( 'ADMIN BCC COPY', $output );
71
-        $this->assertContains( 'A new  listing has been published', $output );
72
-    }
60
+	public function testPostSubmitEmail()
61
+	{
62
+		add_filter('wp_mail', 'print_mail');
63
+		ob_start();
64
+		geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'post_submit');
65
+		$output = ob_get_clean();
66
+		remove_filter('wp_mail', 'print_mail');
67
+		$this->assertContains( 'Post Submitted Successfully', $output );
68
+		$this->assertContains( 'You submitted the below listing information', $output );
69
+		$this->assertContains( '[email protected]', $output );
70
+		$this->assertContains( 'ADMIN BCC COPY', $output );
71
+		$this->assertContains( 'A new  listing has been published', $output );
72
+	}
73 73
 
74
-    public function testListingPublishedEmail()
75
-    {
76
-        add_filter('wp_mail', 'print_mail');
77
-        ob_start();
78
-        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'listing_published');
79
-        $output = ob_get_clean();
80
-        remove_filter('wp_mail', 'print_mail');
81
-        $this->assertContains( 'Listing Published Successfully', $output );
82
-        $this->assertContains( 'Your listing  has been published', $output );
83
-        $this->assertContains( '[email protected]', $output );
84
-        $this->assertContains( 'ADMIN BCC COPY', $output );
85
-    }
74
+	public function testListingPublishedEmail()
75
+	{
76
+		add_filter('wp_mail', 'print_mail');
77
+		ob_start();
78
+		geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'listing_published');
79
+		$output = ob_get_clean();
80
+		remove_filter('wp_mail', 'print_mail');
81
+		$this->assertContains( 'Listing Published Successfully', $output );
82
+		$this->assertContains( 'Your listing  has been published', $output );
83
+		$this->assertContains( '[email protected]', $output );
84
+		$this->assertContains( 'ADMIN BCC COPY', $output );
85
+	}
86 86
 
87
-    public function tearDown()
88
-    {
89
-        parent::tearDown();
90
-    }
87
+	public function tearDown()
88
+	{
89
+		parent::tearDown();
90
+	}
91 91
 }
92 92
 ?>
93 93
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -10,78 +10,78 @@
 block discarded – undo
10 10
     {
11 11
         add_filter('wp_mail', 'print_mail');
12 12
         ob_start();
13
-        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_friend');
13
+        geodir_sendEmail('', '', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_friend');
14 14
         $output = ob_get_clean();
15 15
         remove_filter('wp_mail', 'print_mail');
16
-        $this->assertContains( 'thought you might be interested in', $output );
17
-        $this->assertContains( 'Your friend has sent you a message from', $output );
18
-        $this->assertContains( '[email protected]', $output );
19
-        $this->assertContains( 'ADMIN BCC COPY', $output );
16
+        $this->assertContains('thought you might be interested in', $output);
17
+        $this->assertContains('Your friend has sent you a message from', $output);
18
+        $this->assertContains('[email protected]', $output);
19
+        $this->assertContains('ADMIN BCC COPY', $output);
20 20
     }
21 21
 
22 22
     public function testSendEnquiryEmail()
23 23
     {
24 24
         add_filter('wp_mail', 'print_mail');
25 25
         ob_start();
26
-        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_enquiry');
26
+        geodir_sendEmail('', '', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'send_enquiry');
27 27
         $output = ob_get_clean();
28 28
         remove_filter('wp_mail', 'print_mail');
29
-        $this->assertContains( 'Website Enquiry', $output );
30
-        $this->assertContains( 'An enquiry has been sent from', $output );
31
-        $this->assertContains( '[email protected]', $output );
32
-        $this->assertContains( 'ADMIN BCC COPY', $output );
29
+        $this->assertContains('Website Enquiry', $output);
30
+        $this->assertContains('An enquiry has been sent from', $output);
31
+        $this->assertContains('[email protected]', $output);
32
+        $this->assertContains('ADMIN BCC COPY', $output);
33 33
     }
34 34
 
35 35
     public function testForgotPassEmail()
36 36
     {
37 37
         add_filter('wp_mail', 'print_mail');
38 38
         ob_start();
39
-        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'forgot_password');
39
+        geodir_sendEmail('', '', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'forgot_password');
40 40
         $output = ob_get_clean();
41 41
         remove_filter('wp_mail', 'print_mail');
42
-        $this->assertContains( 'Your new password', $output );
43
-        $this->assertContains( 'You requested a new password for', $output );
44
-        $this->assertContains( '[email protected]', $output );
42
+        $this->assertContains('Your new password', $output);
43
+        $this->assertContains('You requested a new password for', $output);
44
+        $this->assertContains('[email protected]', $output);
45 45
     }
46 46
 
47 47
     public function testRegistrationEmail()
48 48
     {
49 49
         add_filter('wp_mail', 'print_mail');
50 50
         ob_start();
51
-        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'registration');
51
+        geodir_sendEmail('', '', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'registration');
52 52
         $output = ob_get_clean();
53 53
         remove_filter('wp_mail', 'print_mail');
54
-        $this->assertContains( 'Your Log In Details', $output );
55
-        $this->assertContains( 'You can log in  with the following information', $output );
56
-        $this->assertContains( '[email protected]', $output );
57
-        $this->assertContains( 'ADMIN BCC COPY', $output );
54
+        $this->assertContains('Your Log In Details', $output);
55
+        $this->assertContains('You can log in  with the following information', $output);
56
+        $this->assertContains('[email protected]', $output);
57
+        $this->assertContains('ADMIN BCC COPY', $output);
58 58
     }
59 59
 
60 60
     public function testPostSubmitEmail()
61 61
     {
62 62
         add_filter('wp_mail', 'print_mail');
63 63
         ob_start();
64
-        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'post_submit');
64
+        geodir_sendEmail('', '', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'post_submit');
65 65
         $output = ob_get_clean();
66 66
         remove_filter('wp_mail', 'print_mail');
67
-        $this->assertContains( 'Post Submitted Successfully', $output );
68
-        $this->assertContains( 'You submitted the below listing information', $output );
69
-        $this->assertContains( '[email protected]', $output );
70
-        $this->assertContains( 'ADMIN BCC COPY', $output );
71
-        $this->assertContains( 'A new  listing has been published', $output );
67
+        $this->assertContains('Post Submitted Successfully', $output);
68
+        $this->assertContains('You submitted the below listing information', $output);
69
+        $this->assertContains('[email protected]', $output);
70
+        $this->assertContains('ADMIN BCC COPY', $output);
71
+        $this->assertContains('A new  listing has been published', $output);
72 72
     }
73 73
 
74 74
     public function testListingPublishedEmail()
75 75
     {
76 76
         add_filter('wp_mail', 'print_mail');
77 77
         ob_start();
78
-        geodir_sendEmail('','', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'listing_published');
78
+        geodir_sendEmail('', '', '[email protected]', 'Test User', 'Test subject', 'Test message', '', 'listing_published');
79 79
         $output = ob_get_clean();
80 80
         remove_filter('wp_mail', 'print_mail');
81
-        $this->assertContains( 'Listing Published Successfully', $output );
82
-        $this->assertContains( 'Your listing  has been published', $output );
83
-        $this->assertContains( '[email protected]', $output );
84
-        $this->assertContains( 'ADMIN BCC COPY', $output );
81
+        $this->assertContains('Listing Published Successfully', $output);
82
+        $this->assertContains('Your listing  has been published', $output);
83
+        $this->assertContains('[email protected]', $output);
84
+        $this->assertContains('ADMIN BCC COPY', $output);
85 85
     }
86 86
 
87 87
     public function tearDown()
Please login to merge, or discard this patch.
tests/test-Test_Dummy_Data.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,50 +1,50 @@
 block discarded – undo
1 1
 <?php
2 2
 class TestDummyData extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-        wp_set_current_user(1);
8
-        geodir_delete_dummy_posts();
9
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+		wp_set_current_user(1);
8
+		geodir_delete_dummy_posts();
9
+	}
10 10
 
11
-    public function testCreatePlaces()
12
-    {
13
-        global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
11
+	public function testCreatePlaces()
12
+	{
13
+		global $dummy_post_index, $city_bound_lat1, $city_bound_lng1, $city_bound_lat2, $city_bound_lng2;
14 14
 
15
-        global $geodir_post_custom_fields_cache;
16
-        $geodir_post_custom_fields_cache = array();
15
+		global $geodir_post_custom_fields_cache;
16
+		$geodir_post_custom_fields_cache = array();
17 17
 
18
-        $city_bound_lat1 = 40.4960439;
19
-        $city_bound_lng1 = -74.2557349;
20
-        $city_bound_lat2 = 40.91525559999999;
21
-        $city_bound_lng2 = -73.7002721;
18
+		$city_bound_lat1 = 40.4960439;
19
+		$city_bound_lng1 = -74.2557349;
20
+		$city_bound_lat2 = 40.91525559999999;
21
+		$city_bound_lng2 = -73.7002721;
22 22
 
23 23
 
24
-        $dummy_post_index = 10;
25
-        test_create_dummy_posts(10);
24
+		$dummy_post_index = 10;
25
+		test_create_dummy_posts(10);
26 26
 
27
-        $query_args = array(
28
-            'post_status' => 'publish',
29
-            'post_type' => 'gd_place'
30
-        );
27
+		$query_args = array(
28
+			'post_status' => 'publish',
29
+			'post_type' => 'gd_place'
30
+		);
31 31
 
32
-        $all_posts = new WP_Query( $query_args );
32
+		$all_posts = new WP_Query( $query_args );
33 33
 
34
-        $total_posts = $all_posts->found_posts;
34
+		$total_posts = $all_posts->found_posts;
35 35
 
36
-        $this->assertTrue((int) $total_posts > 0);
36
+		$this->assertTrue((int) $total_posts > 0);
37 37
 
38
-    }
38
+	}
39 39
 
40
-    public function testDeletePlaces()
41
-    {
42
-        geodir_delete_dummy_posts();
43
-    }
40
+	public function testDeletePlaces()
41
+	{
42
+		geodir_delete_dummy_posts();
43
+	}
44 44
 
45
-    public function tearDown()
46
-    {
47
-        parent::tearDown();
48
-    }
45
+	public function tearDown()
46
+	{
47
+		parent::tearDown();
48
+	}
49 49
 }
50 50
 ?>
51 51
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
             'post_type' => 'gd_place'
30 30
         );
31 31
 
32
-        $all_posts = new WP_Query( $query_args );
32
+        $all_posts = new WP_Query($query_args);
33 33
 
34 34
         $total_posts = $all_posts->found_posts;
35 35
 
Please login to merge, or discard this patch.
tests/test-Import_Export.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1 1
 <?php
2 2
 class ImportExport extends WP_UnitTestCase
3 3
 {
4
-    public function setUp()
5
-    {
6
-        parent::setUp();
7
-    }
4
+	public function setUp()
5
+	{
6
+		parent::setUp();
7
+	}
8 8
 
9
-    public function testImportExport()
10
-    {
9
+	public function testImportExport()
10
+	{
11 11
 
12
-    }
12
+	}
13 13
 
14
-    public function tearDown()
15
-    {
16
-        parent::tearDown();
17
-    }
14
+	public function tearDown()
15
+	{
16
+		parent::tearDown();
17
+	}
18 18
 }
19 19
 ?>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-admin/admin_functions.php 1 patch
Indentation   +2634 added lines, -2634 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 function geodir_deactivation()
16 16
 {
17 17
 
18
-    // Update installed variable
19
-    update_option("geodir_installed", 0);
18
+	// Update installed variable
19
+	update_option("geodir_installed", 0);
20 20
 
21
-    // Remove rewrite rules and then recreate rewrite rules.
22
-    flush_rewrite_rules();
21
+	// Remove rewrite rules and then recreate rewrite rules.
22
+	flush_rewrite_rules();
23 23
 }
24 24
 
25 25
 
@@ -32,105 +32,105 @@  discard block
 block discarded – undo
32 32
 function geodir_uninstall()
33 33
 {
34 34
 
35
-    delete_option('geodir_default_data_installed');
35
+	delete_option('geodir_default_data_installed');
36 36
 
37 37
 }
38 38
 
39 39
 if (!function_exists('geodir_admin_styles')) {
40
-    /**
41
-     * Enqueue Admin Styles.
42
-     *
43
-     * @since 1.0.0
44
-     * @package GeoDirectory
45
-     */
46
-    function geodir_admin_styles()
47
-    {
40
+	/**
41
+	 * Enqueue Admin Styles.
42
+	 *
43
+	 * @since 1.0.0
44
+	 * @package GeoDirectory
45
+	 */
46
+	function geodir_admin_styles()
47
+	{
48 48
 
49
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
50
-        wp_enqueue_style('geodirectory-admin-css');
49
+		wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
50
+		wp_enqueue_style('geodirectory-admin-css');
51 51
 
52
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
53
-        wp_enqueue_style('geodirectory-frontend-style');
52
+		wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
53
+		wp_enqueue_style('geodirectory-frontend-style');
54 54
 
55
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
56
-        wp_enqueue_style('geodir-chosen-style');
55
+		wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
56
+		wp_enqueue_style('geodir-chosen-style');
57 57
 
58
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
59
-        wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
58
+		wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
59
+		wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
60 60
 
61
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
62
-        wp_enqueue_style('geodirectory-jquery-ui-css');
61
+		wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
62
+		wp_enqueue_style('geodirectory-jquery-ui-css');
63 63
 
64
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
65
-        wp_enqueue_style('geodirectory-custom-fields-css');
64
+		wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
65
+		wp_enqueue_style('geodirectory-custom-fields-css');
66 66
 
67
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
68
-        wp_enqueue_style('geodirectory-pluplodar-css');
67
+		wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
68
+		wp_enqueue_style('geodirectory-pluplodar-css');
69 69
 
70
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
71
-        wp_enqueue_style('geodir-rating-style');
70
+		wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
71
+		wp_enqueue_style('geodir-rating-style');
72 72
 
73
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
74
-        wp_enqueue_style('geodir-rtl-style');
73
+		wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
74
+		wp_enqueue_style('geodir-rtl-style');
75 75
 
76
-    }
76
+	}
77 77
 }
78 78
 
79 79
 if (!function_exists('geodir_admin_styles_req')) {
80
-    /**
81
-     * Loads stylesheets from CDN.
82
-     *
83
-     * @since 1.0.0
84
-     * @package GeoDirectory
85
-     */
86
-    function geodir_admin_styles_req()
87
-    {
80
+	/**
81
+	 * Loads stylesheets from CDN.
82
+	 *
83
+	 * @since 1.0.0
84
+	 * @package GeoDirectory
85
+	 */
86
+	function geodir_admin_styles_req()
87
+	{
88 88
 
89
-        wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90
-        wp_enqueue_style('geodirectory-font-awesome');
89
+		wp_register_style('geodirectory-font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
90
+		wp_enqueue_style('geodirectory-font-awesome');
91 91
 
92
-        wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
93
-        wp_enqueue_script('geodirectory-admin');
92
+		wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
93
+		wp_enqueue_script('geodirectory-admin');
94 94
 
95
-    }
95
+	}
96 96
 }
97 97
 
98 98
 if (!function_exists('geodir_admin_scripts')) {
99
-    /**
100
-     * Enqueue Admin Scripts.
101
-     *
102
-     * @since 1.0.0
103
-     * @package GeoDirectory
104
-     */
105
-    function geodir_admin_scripts()
106
-    {
99
+	/**
100
+	 * Enqueue Admin Scripts.
101
+	 *
102
+	 * @since 1.0.0
103
+	 * @package GeoDirectory
104
+	 */
105
+	function geodir_admin_scripts()
106
+	{
107 107
 
108
-        wp_enqueue_script('jquery');
108
+		wp_enqueue_script('jquery');
109 109
 
110
-        wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
110
+		wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), '', true);
111 111
 
112
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array(), GEODIRECTORY_VERSION);
113
-        wp_enqueue_script('chosen');
112
+		wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array(), GEODIRECTORY_VERSION);
113
+		wp_enqueue_script('chosen');
114 114
 
115
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
116
-        wp_enqueue_script('geodirectory-choose-ajax');
115
+		wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
116
+		wp_enqueue_script('geodirectory-choose-ajax');
117 117
 
118
-        if (isset($_REQUEST['listing_type'])) {
119
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
120
-        }
118
+		if (isset($_REQUEST['listing_type'])) {
119
+			wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
120
+		}
121 121
 
122
-        wp_enqueue_script('geodirectory-custom-fields-script');
123
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
122
+		wp_enqueue_script('geodirectory-custom-fields-script');
123
+		$plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
124 124
 
125
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
125
+		wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
126 126
 
127
-        $map_lang = "&language=" . geodir_get_map_default_language();
128
-        /** This filter is documented in geodirectory_template_tags.php */
129
-        $map_extra = apply_filters('geodir_googlemap_script_extra', '');
130
-        wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
127
+		$map_lang = "&language=" . geodir_get_map_default_language();
128
+		/** This filter is documented in geodirectory_template_tags.php */
129
+		$map_extra = apply_filters('geodir_googlemap_script_extra', '');
130
+		wp_enqueue_script('geodirectory-googlemap-script', '//maps.google.com/maps/api/js?' . $map_lang . $map_extra, '', NULL);
131 131
 
132
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
133
-        wp_enqueue_script('geodirectory-goMap-script');
132
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
133
+		wp_enqueue_script('geodirectory-goMap-script');
134 134
 
135 135
 		// font awesome rating script
136 136
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
@@ -141,177 +141,177 @@  discard block
 block discarded – undo
141 141
 			wp_enqueue_script('geodir-jRating-js');
142 142
 		}
143 143
 
144
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
145
-        wp_enqueue_script('geodir-on-document-load');
146
-
147
-
148
-        // SCRIPT FOR UPLOAD
149
-        wp_enqueue_script('plupload-all');
150
-        wp_enqueue_script('jquery-ui-sortable');
151
-
152
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
153
-        wp_enqueue_script('geodirectory-plupload-script');
154
-
155
-        // SCRIPT FOR UPLOAD END
156
-
157
-
158
-        // place js config array for plupload
159
-        $plupload_init = array(
160
-            'runtimes' => 'html5,silverlight,flash,html4',
161
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
162
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
163
-            'drop_element' => 'dropbox', // will be adjusted per uploader
164
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
165
-            'multiple_queues' => true,
166
-            'max_file_size' => geodir_max_upload_size(),
167
-            'url' => admin_url('admin-ajax.php'),
168
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
169
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
170
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
171
-            'multipart' => true,
172
-            'urlstream_upload' => true,
173
-            'multi_selection' => false, // will be added per uploader
174
-            // additional post data to send to our ajax hook
175
-            'multipart_params' => array(
176
-                '_ajax_nonce' => "", // will be added per uploader
177
-                'action' => 'plupload_action', // the ajax action name
178
-                'imgid' => 0 // will be added per uploader
179
-            )
180
-        );
181
-        $base_plupload_config = json_encode($plupload_init);
182
-
183
-
184
-        $thumb_img_arr = array();
185
-
186
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
187
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
188
-
189
-        $totImg = '';
190
-        $image_limit = '';
191
-        if (!empty($thumb_img_arr)) {
192
-            foreach ($thumb_img_arr as $img) {
193
-                $curImages = $img->src . ",";
194
-            }
144
+		wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.js', array(), GEODIRECTORY_VERSION);
145
+		wp_enqueue_script('geodir-on-document-load');
146
+
147
+
148
+		// SCRIPT FOR UPLOAD
149
+		wp_enqueue_script('plupload-all');
150
+		wp_enqueue_script('jquery-ui-sortable');
151
+
152
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
153
+		wp_enqueue_script('geodirectory-plupload-script');
154
+
155
+		// SCRIPT FOR UPLOAD END
156
+
157
+
158
+		// place js config array for plupload
159
+		$plupload_init = array(
160
+			'runtimes' => 'html5,silverlight,flash,html4',
161
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
162
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
163
+			'drop_element' => 'dropbox', // will be adjusted per uploader
164
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
165
+			'multiple_queues' => true,
166
+			'max_file_size' => geodir_max_upload_size(),
167
+			'url' => admin_url('admin-ajax.php'),
168
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
169
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
170
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
171
+			'multipart' => true,
172
+			'urlstream_upload' => true,
173
+			'multi_selection' => false, // will be added per uploader
174
+			// additional post data to send to our ajax hook
175
+			'multipart_params' => array(
176
+				'_ajax_nonce' => "", // will be added per uploader
177
+				'action' => 'plupload_action', // the ajax action name
178
+				'imgid' => 0 // will be added per uploader
179
+			)
180
+		);
181
+		$base_plupload_config = json_encode($plupload_init);
182
+
183
+
184
+		$thumb_img_arr = array();
185
+
186
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
187
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
188
+
189
+		$totImg = '';
190
+		$image_limit = '';
191
+		if (!empty($thumb_img_arr)) {
192
+			foreach ($thumb_img_arr as $img) {
193
+				$curImages = $img->src . ",";
194
+			}
195 195
 
196
-            $totImg = count($thumb_img_arr);
197
-        }
196
+			$totImg = count($thumb_img_arr);
197
+		}
198 198
 
199 199
 
200
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
201
-            'totalImg' => $totImg,
202
-            'image_limit' => $image_limit,
203
-            'upload_img_size' => geodir_max_upload_size());
200
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
201
+			'totalImg' => $totImg,
202
+			'image_limit' => $image_limit,
203
+			'upload_img_size' => geodir_max_upload_size());
204 204
 
205
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
205
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
206 206
 
207
-        $ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
208
-        wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
207
+		$ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
208
+		wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
209 209
 
210 210
 
211
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
212
-        wp_enqueue_script('geodirectory-admin-script');
211
+		wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
212
+		wp_enqueue_script('geodirectory-admin-script');
213 213
 
214
-        wp_enqueue_style('farbtastic');
215
-        wp_enqueue_script('farbtastic');
214
+		wp_enqueue_style('farbtastic');
215
+		wp_enqueue_script('farbtastic');
216 216
 
217
-        $screen = get_current_screen();
218
-        if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
219
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
220
-        }
217
+		$screen = get_current_screen();
218
+		if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
219
+			wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
220
+		}
221 221
 
222
-        $ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
223
-        wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
222
+		$ajax_cons_data = array('url' => __(get_option('siteurl') . '?geodir_ajax=true'));
223
+		wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
224 224
 
225
-    }
225
+	}
226 226
 }
227 227
 
228 228
 if (!function_exists('geodir_admin_menu')) {
229
-    /**
230
-     * Admin Menus
231
-     *
232
-     * Sets up the admin menus in wordpress.
233
-     *
234
-     * @since 1.0.0
235
-     * @package GeoDirectory
236
-     * @global array $menu Menu array.
237
-     * @global object $geodirectory GeoDirectory plugin object.
238
-     */
239
-    function geodir_admin_menu()
240
-    {
241
-        global $menu, $geodirectory;
229
+	/**
230
+	 * Admin Menus
231
+	 *
232
+	 * Sets up the admin menus in wordpress.
233
+	 *
234
+	 * @since 1.0.0
235
+	 * @package GeoDirectory
236
+	 * @global array $menu Menu array.
237
+	 * @global object $geodirectory GeoDirectory plugin object.
238
+	 */
239
+	function geodir_admin_menu()
240
+	{
241
+		global $menu, $geodirectory;
242 242
 
243
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
243
+		if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
244 244
 
245
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
245
+		add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
246 246
 
247 247
 
248
-    }
248
+	}
249 249
 }
250 250
 
251 251
 if (!function_exists('geodir_admin_menu_order')) {
252
-    /**
253
-     * Order admin menus.
254
-     *
255
-     * @since 1.0.0
256
-     * @package GeoDirectory
257
-     * @param array $menu_order Menu order array.
258
-     * @return array Modified menu order array.
259
-     */
260
-    function geodir_admin_menu_order($menu_order)
261
-    {
262
-
263
-        // Initialize our custom order array
264
-        $geodir_menu_order = array();
265
-
266
-        // Get the index of our custom separator
267
-        $geodir_separator = array_search('separator-geodirectory', $menu_order);
268
-
269
-        // Get index of posttype menu
270
-        $post_types = geodir_get_posttypes();
271
-        if (!empty($post_types)) {
272
-            foreach ($post_types as $post_type) {
273
-                $geodir_posts = array_search("edit.php?post_type={$post_type}", $menu_order);
274
-            }
275
-        }
252
+	/**
253
+	 * Order admin menus.
254
+	 *
255
+	 * @since 1.0.0
256
+	 * @package GeoDirectory
257
+	 * @param array $menu_order Menu order array.
258
+	 * @return array Modified menu order array.
259
+	 */
260
+	function geodir_admin_menu_order($menu_order)
261
+	{
276 262
 
277
-        // Loop through menu order and do some rearranging
278
-        foreach ($menu_order as $index => $item) :
263
+		// Initialize our custom order array
264
+		$geodir_menu_order = array();
279 265
 
280
-            if ((('geodirectory') == $item)) :
281
-                $geodir_menu_order[] = 'separator-geodirectory';
282
-                if (!empty($post_types)) {
283
-                    foreach ($post_types as $post_type) {
284
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
285
-                    }
286
-                }
287
-                $geodir_menu_order[] = $item;
266
+		// Get the index of our custom separator
267
+		$geodir_separator = array_search('separator-geodirectory', $menu_order);
288 268
 
289
-                unset($menu_order[$geodir_separator]);
290
-            //unset( $menu_order[$geodir_places] );
291
-            elseif (!in_array($item, array('separator-geodirectory'))) :
292
-                $geodir_menu_order[] = $item;
293
-            endif;
269
+		// Get index of posttype menu
270
+		$post_types = geodir_get_posttypes();
271
+		if (!empty($post_types)) {
272
+			foreach ($post_types as $post_type) {
273
+				$geodir_posts = array_search("edit.php?post_type={$post_type}", $menu_order);
274
+			}
275
+		}
294 276
 
295
-        endforeach;
277
+		// Loop through menu order and do some rearranging
278
+		foreach ($menu_order as $index => $item) :
296 279
 
297
-        // Return order
298
-        return $geodir_menu_order;
299
-    }
280
+			if ((('geodirectory') == $item)) :
281
+				$geodir_menu_order[] = 'separator-geodirectory';
282
+				if (!empty($post_types)) {
283
+					foreach ($post_types as $post_type) {
284
+						$geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
285
+					}
286
+				}
287
+				$geodir_menu_order[] = $item;
288
+
289
+				unset($menu_order[$geodir_separator]);
290
+			//unset( $menu_order[$geodir_places] );
291
+			elseif (!in_array($item, array('separator-geodirectory'))) :
292
+				$geodir_menu_order[] = $item;
293
+			endif;
294
+
295
+		endforeach;
296
+
297
+		// Return order
298
+		return $geodir_menu_order;
299
+	}
300 300
 }
301 301
 
302 302
 if (!function_exists('geodir_admin_custom_menu_order')) {
303
-    /**
304
-     * Enables custom menu order.
305
-     *
306
-     * @since 1.0.0
307
-     * @package GeoDirectory
308
-     * @return bool
309
-     */
310
-    function geodir_admin_custom_menu_order()
311
-    {
312
-        if (!current_user_can('manage_options')) return false;
313
-        return true;
314
-    }
303
+	/**
304
+	 * Enables custom menu order.
305
+	 *
306
+	 * @since 1.0.0
307
+	 * @package GeoDirectory
308
+	 * @return bool
309
+	 */
310
+	function geodir_admin_custom_menu_order()
311
+	{
312
+		if (!current_user_can('manage_options')) return false;
313
+		return true;
314
+	}
315 315
 }
316 316
 
317 317
 /**
@@ -322,41 +322,41 @@  discard block
 block discarded – undo
322 322
  */
323 323
 function geodir_before_admin_panel()
324 324
 {
325
-    if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
326
-        echo '<div id="message" class="updated fade">
325
+	if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
326
+		echo '<div id="message" class="updated fade">
327 327
                         <p style="float:right;">' . __('Like Geodirectory?', 'geodirectory') . ' <a href="http://wordpress.org/extend/plugins/Geodirectory/" target="_blank">' . __('Support us by leaving a rating!', 'geodirectory') . '</a></p>
328 328
                         <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
329 329
                 </div>';
330 330
 
331
-    }
331
+	}
332 332
 
333
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
334
-        switch ($_REQUEST['msg']) {
335
-            case 'success':
336
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
337
-                flush_rewrite_rules(false);
333
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
334
+		switch ($_REQUEST['msg']) {
335
+			case 'success':
336
+				echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
337
+				flush_rewrite_rules(false);
338 338
 
339
-                break;
339
+				break;
340 340
 			case 'fail':
341 341
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
342 342
 				
343 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>';
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 345
 				else
346 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
-                break;
348
-        }
349
-    }
347
+				break;
348
+		}
349
+	}
350 350
 
351
-    if (!geodir_is_default_location_set()) {
352
-        echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
351
+	if (!geodir_is_default_location_set()) {
352
+		echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
353 353
 
354
-    }
354
+	}
355 355
 
356
-    if (!function_exists('curl_init')) {
357
-        echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
356
+	if (!function_exists('curl_init')) {
357
+		echo '<div class="error"><p><strong>' . __('CURL is not installed on this server, this can cause problems, please ask your server admin to install it.', 'geodirectory') . '</strong></p></div>';
358 358
 
359
-    }
359
+	}
360 360
 }
361 361
 
362 362
 /**
@@ -369,19 +369,19 @@  discard block
 block discarded – undo
369 369
  */
370 370
 function geodir_handle_option_form_submit($current_tab)
371 371
 {
372
-    global $geodir_settings;
373
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
374
-        /**
375
-         * Contains settings array for current tab.
376
-         *
377
-         * @since 1.0.0
378
-         * @package GeoDirectory
379
-         */
380
-        include_once('option-pages/' . $current_tab . '_array.php');
381
-    }
382
-    if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
383
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
384
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
372
+	global $geodir_settings;
373
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
374
+		/**
375
+		 * Contains settings array for current tab.
376
+		 *
377
+		 * @since 1.0.0
378
+		 * @package GeoDirectory
379
+		 */
380
+		include_once('option-pages/' . $current_tab . '_array.php');
381
+	}
382
+	if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
383
+		if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
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 386
 		/**
387 387
 		 * Fires before updating geodirectory admin settings.
@@ -393,100 +393,100 @@  discard block
 block discarded – undo
393 393
 		 */
394 394
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
395 395
 		
396
-        if (!empty($geodir_settings[$current_tab]))
397
-            geodir_update_options($geodir_settings[$current_tab]);
396
+		if (!empty($geodir_settings[$current_tab]))
397
+			geodir_update_options($geodir_settings[$current_tab]);
398 398
 
399
-        /**
400
-         * Called after GeoDirectory options settings are updated.
401
-         *
402
-         * @since 1.0.0
403
-         * @param array $geodir_settings The array of GeoDirectory settings.
404
-         * @see 'geodir_before_update_options'
405
-         */
406
-        do_action('geodir_update_options', $geodir_settings);
399
+		/**
400
+		 * Called after GeoDirectory options settings are updated.
401
+		 *
402
+		 * @since 1.0.0
403
+		 * @param array $geodir_settings The array of GeoDirectory settings.
404
+		 * @see 'geodir_before_update_options'
405
+		 */
406
+		do_action('geodir_update_options', $geodir_settings);
407 407
 
408
-        /**
409
-         * Called after GeoDirectory options settings are updated.
410
-         *
411
-         * Provides tab specific settings.
412
-         *
413
-         * @since 1.0.0
414
-         * @param string $current_tab The current settings tab name.
415
-         * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
416
-         */
417
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
408
+		/**
409
+		 * Called after GeoDirectory options settings are updated.
410
+		 *
411
+		 * Provides tab specific settings.
412
+		 *
413
+		 * @since 1.0.0
414
+		 * @param string $current_tab The current settings tab name.
415
+		 * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
416
+		 */
417
+		do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
418 418
 
419
-        flush_rewrite_rules(false);
419
+		flush_rewrite_rules(false);
420 420
 
421
-        $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
421
+		$current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
422 422
 
423
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
423
+		$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
424 424
 
425
-        wp_redirect($redirect_url);
426
-        exit();
427
-    endif;
425
+		wp_redirect($redirect_url);
426
+		exit();
427
+	endif;
428 428
 
429 429
 
430 430
 }
431 431
 
432 432
 
433 433
 if (!function_exists('geodir_autoinstall_admin_header') && get_option('geodir_installed')) {
434
-    /**
435
-     * GeoDirectory dummy data installation.
436
-     *
437
-     * @since 1.0.0
438
-     * @package GeoDirectory
439
-     * @global object $wpdb WordPress Database object.
440
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
441
-     * @param string $post_type The post type.
442
-     */
443
-    function geodir_autoinstall_admin_header($post_type = 'gd_place')
444
-    {
434
+	/**
435
+	 * GeoDirectory dummy data installation.
436
+	 *
437
+	 * @since 1.0.0
438
+	 * @package GeoDirectory
439
+	 * @global object $wpdb WordPress Database object.
440
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
441
+	 * @param string $post_type The post type.
442
+	 */
443
+	function geodir_autoinstall_admin_header($post_type = 'gd_place')
444
+	{
445 445
 
446
-        global $wpdb, $plugin_prefix;
446
+		global $wpdb, $plugin_prefix;
447 447
 
448
-        if (!geodir_is_default_location_set()) {
449
-            echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
450
-        } else {
448
+		if (!geodir_is_default_location_set()) {
449
+			echo '<div class="updated fade"><p><strong>' . sprintf(__('Please %sclick here%s to set a default location, this will help to set location of all dummy data.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>') . '</strong></p></div>';
450
+		} else {
451 451
 
452
-            $geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
452
+			$geodir_url = admin_url() . 'admin.php?page=geodirectory&tab=general_settings&active_tab=';
453 453
 
454
-            $post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
454
+			$post_counts = $wpdb->get_var("SELECT count(post_id) FROM " . $plugin_prefix . $post_type . "_detail WHERE post_dummy='1'");
455 455
 
456
-            if ($post_counts > 0) {
457
-                $nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
456
+			if ($post_counts > 0) {
457
+				$nonce = wp_create_nonce('geodir_dummy_posts_delete_noncename');
458 458
 
459
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . SAMPLE_DATA_SHOW_MSG . '</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\'' . $nonce . '\',\'' . $post_type . '\')" href="javascript:void(0);" redirect_to="' . $geodir_url . '"  >' . DELETE_BTN_SAMPLE_MSG . '</a></p></div>';
460
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_DELETE_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
461
-            } else {
462
-                $options_list = '';
463
-                for ($option = 1; $option <= 30; $option++) {
464
-                    $selected = '';
465
-                    if ($option == 10)
466
-                        $selected = 'selected="selected"';
459
+				$dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . SAMPLE_DATA_SHOW_MSG . '</b><br /><a id="geodir_dummy_delete" class="button_delete" onclick="geodir_autoinstall(this,\'geodir_dummy_delete\',\'' . $nonce . '\',\'' . $post_type . '\')" href="javascript:void(0);" redirect_to="' . $geodir_url . '"  >' . DELETE_BTN_SAMPLE_MSG . '</a></p></div>';
460
+				$dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_DELETE_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /></p></div>';
461
+			} else {
462
+				$options_list = '';
463
+				for ($option = 1; $option <= 30; $option++) {
464
+					$selected = '';
465
+					if ($option == 10)
466
+						$selected = 'selected="selected"';
467 467
 
468
-                    $options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
469
-                }
468
+					$options_list .= '<option ' . $selected . ' value="' . $option . '">' . $option . '</option>';
469
+				}
470 470
 
471
-                $nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
471
+				$nonce = wp_create_nonce('geodir_dummy_posts_insert_noncename');
472 472
 
473
-                $dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . AUTO_INSATALL_MSG . '</b><br /><select class="selected_sample_data">' . $options_list . '</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\'' . $nonce . '\',\'' . $post_type . '\')"   redirect_to="' . $geodir_url . '" >' . INSERT_BTN_SAMPLE_MSG . '</a></p></div>';
474
-                $dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_IMPORT_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
473
+				$dummy_msg = '<div id="" class="geodir_auto_install updated highlight fade"><p><b>' . AUTO_INSATALL_MSG . '</b><br /><select class="selected_sample_data">' . $options_list . '</select><a id="geodir_dummy_insert" class="button_insert" href="javascript:void(0);" onclick="geodir_autoinstall(this,\'geodir_dummy_insert\',\'' . $nonce . '\',\'' . $post_type . '\')"   redirect_to="' . $geodir_url . '" >' . INSERT_BTN_SAMPLE_MSG . '</a></p></div>';
474
+				$dummy_msg .= '<div id="" style="display:none;" class="geodir_show_progress updated highlight fade"><p><b>' . GEODIR_SAMPLE_DATA_IMPORT_MSG . '</b><br><img src="' . geodir_plugin_url() . '/geodirectory-assets/images/loadingAnimation.gif" /><br><span class="dummy_post_inserted"></span></div>';
475 475
 
476
-            }
477
-            echo $dummy_msg;
478
-            ?>
476
+			}
477
+			echo $dummy_msg;
478
+			?>
479 479
             <script>
480 480
                 <?php
481 481
 
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 : '';
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 : '';
488 488
 
489
-                ?>
489
+				?>
490 490
                 var geocoder = new google.maps.Geocoder();
491 491
                 var CITY_ADDRESS = '<?php echo $city.','.$region.','.$country;?>';
492 492
                 var bound_lat_lng;
@@ -571,8 +571,8 @@  discard block
 block discarded – undo
571 571
                 }
572 572
             </script>
573 573
         <?php
574
-        }
575
-    }
574
+		}
575
+	}
576 576
 }
577 577
 
578 578
 /**
@@ -585,19 +585,19 @@  discard block
 block discarded – undo
585 585
  */
586 586
 function geodir_insert_dummy_posts()
587 587
 {
588
-    geodir_default_taxonomies();
588
+	geodir_default_taxonomies();
589 589
 
590
-    ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
590
+	ini_set('max_execution_time', 999999); //300 seconds = 5 minutes
591 591
 
592
-    global $wpdb, $current_user;
592
+	global $wpdb, $current_user;
593 593
 
594
-    /**
595
-     * Contains dumy post content.
596
-     *
597
-     * @since 1.0.0
598
-     * @package GeoDirectory
599
-     */
600
-    include_once('place_dummy_post.php');
594
+	/**
595
+	 * Contains dumy post content.
596
+	 *
597
+	 * @since 1.0.0
598
+	 * @package GeoDirectory
599
+	 */
600
+	include_once('place_dummy_post.php');
601 601
 
602 602
 }
603 603
 
@@ -611,18 +611,18 @@  discard block
 block discarded – undo
611 611
  */
612 612
 function geodir_delete_dummy_posts()
613 613
 {
614
-    global $wpdb, $plugin_prefix;
614
+	global $wpdb, $plugin_prefix;
615 615
 
616 616
 
617
-    $post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
617
+	$post_ids = $wpdb->get_results("SELECT post_id FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
618 618
 
619 619
 
620
-    foreach ($post_ids as $post_ids_obj) {
621
-        wp_delete_post($post_ids_obj->post_id);
622
-    }
620
+	foreach ($post_ids as $post_ids_obj) {
621
+		wp_delete_post($post_ids_obj->post_id);
622
+	}
623 623
 
624
-    //double check posts are deleted
625
-    $wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
624
+	//double check posts are deleted
625
+	$wpdb->get_results("DELETE FROM " . $plugin_prefix . "gd_place_detail WHERE post_dummy='1'");
626 626
 }
627 627
 
628 628
 /**
@@ -636,116 +636,116 @@  discard block
 block discarded – undo
636 636
  * @global string $dummy_image_path The dummy image path.
637 637
  */
638 638
 function geodir_default_taxonomies() {
639
-    global $wpdb, $dummy_image_path;
639
+	global $wpdb, $dummy_image_path;
640 640
 
641
-    $category_array = array('Attractions', 'Hotels', 'Restaurants', 'Food Nightlife', 'Festival', 'Videos', 'Feature');
641
+	$category_array = array('Attractions', 'Hotels', 'Restaurants', 'Food Nightlife', 'Festival', 'Videos', 'Feature');
642 642
 
643
-    $last_catid = isset($last_catid) ? $last_catid : '';
643
+	$last_catid = isset($last_catid) ? $last_catid : '';
644 644
 
645
-    $last_term = get_term($last_catid, 'gd_placecategory');
645
+	$last_term = get_term($last_catid, 'gd_placecategory');
646 646
 
647
-    $uploads = wp_upload_dir(); // Array of key => value pairs
647
+	$uploads = wp_upload_dir(); // Array of key => value pairs
648 648
 
649
-    for ($i = 0; $i < count($category_array); $i++) {
650
-        $parent_catid = 0;
651
-        if (is_array($category_array[$i])) {
652
-            $cat_name_arr = $category_array[$i];
653
-            for ($j = 0; $j < count($cat_name_arr); $j++) {
654
-                $catname = $cat_name_arr[$j];
649
+	for ($i = 0; $i < count($category_array); $i++) {
650
+		$parent_catid = 0;
651
+		if (is_array($category_array[$i])) {
652
+			$cat_name_arr = $category_array[$i];
653
+			for ($j = 0; $j < count($cat_name_arr); $j++) {
654
+				$catname = $cat_name_arr[$j];
655 655
 
656
-                if (!term_exists($catname, 'gd_placecategory')) {
657
-                    $last_catid = wp_insert_term($catname, 'gd_placecategory', $args = array('parent' => $parent_catid));
656
+				if (!term_exists($catname, 'gd_placecategory')) {
657
+					$last_catid = wp_insert_term($catname, 'gd_placecategory', $args = array('parent' => $parent_catid));
658 658
 
659
-                    if ($j == 0) {
660
-                        $parent_catid = $last_catid;
661
-                    }
659
+					if ($j == 0) {
660
+						$parent_catid = $last_catid;
661
+					}
662 662
 
663 663
 
664
-                    if (geodir_dummy_folder_exists())
665
-                        $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
666
-                    else
667
-                        $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
664
+					if (geodir_dummy_folder_exists())
665
+						$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
666
+					else
667
+						$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
668 668
 
669
-                    $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
669
+					$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
670 670
 
671
-                    $catname = str_replace(' ', '_', $catname);
672
-                    $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
671
+					$catname = str_replace(' ', '_', $catname);
672
+					$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
673 673
 
674
-                    if (empty($uploaded['error'])) {
675
-                        $new_path = $uploaded['file'];
676
-                        $new_url = $uploaded['url'];
677
-                    }
674
+					if (empty($uploaded['error'])) {
675
+						$new_path = $uploaded['file'];
676
+						$new_url = $uploaded['url'];
677
+					}
678 678
 
679
-                    $wp_filetype = wp_check_filetype(basename($new_path), null);
680
-
681
-                    $attachment = array(
682
-                        'guid' => $uploads['baseurl'] . '/' . basename($new_path),
683
-                        'post_mime_type' => $wp_filetype['type'],
684
-                        'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
685
-                        'post_content' => '',
686
-                        'post_status' => 'inherit'
687
-                    );
688
-                    $attach_id = wp_insert_attachment($attachment, $new_path);
689
-
690
-                    // you must first include the image.php file
691
-                    // for the function wp_generate_attachment_metadata() to work
692
-                    require_once(ABSPATH . 'wp-admin/includes/image.php');
693
-                    $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
694
-                    wp_update_attachment_metadata($attach_id, $attach_data);
695
-
696
-                    if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
697
-                        update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), 'gd_place');
698
-                    }
699
-                }
700
-            }
679
+					$wp_filetype = wp_check_filetype(basename($new_path), null);
680
+
681
+					$attachment = array(
682
+						'guid' => $uploads['baseurl'] . '/' . basename($new_path),
683
+						'post_mime_type' => $wp_filetype['type'],
684
+						'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
685
+						'post_content' => '',
686
+						'post_status' => 'inherit'
687
+					);
688
+					$attach_id = wp_insert_attachment($attachment, $new_path);
689
+
690
+					// you must first include the image.php file
691
+					// for the function wp_generate_attachment_metadata() to work
692
+					require_once(ABSPATH . 'wp-admin/includes/image.php');
693
+					$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
694
+					wp_update_attachment_metadata($attach_id, $attach_data);
695
+
696
+					if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
697
+						update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => 'icon', 'src' => $new_url), 'gd_place');
698
+					}
699
+				}
700
+			}
701 701
 
702
-        } else {
703
-            $catname = $category_array[$i];
702
+		} else {
703
+			$catname = $category_array[$i];
704 704
 
705
-            if (!term_exists($catname, 'gd_placecategory')) {
706
-                $last_catid = wp_insert_term($catname, 'gd_placecategory');
705
+			if (!term_exists($catname, 'gd_placecategory')) {
706
+				$last_catid = wp_insert_term($catname, 'gd_placecategory');
707 707
 
708
-                if (geodir_dummy_folder_exists())
709
-                    $dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
710
-                else
711
-                    $dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
708
+				if (geodir_dummy_folder_exists())
709
+					$dummy_image_url = geodir_plugin_url() . "/geodirectory-admin/dummy/cat_icon";
710
+				else
711
+					$dummy_image_url = 'http://www.wpgeodirectory.com/dummy/cat_icon';
712 712
 
713
-                $dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
713
+				$dummy_image_url = apply_filters('place_dummy_cat_image_url', $dummy_image_url);
714 714
 
715
-                $catname = str_replace(' ', '_', $catname);
716
-                $uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
715
+				$catname = str_replace(' ', '_', $catname);
716
+				$uploaded = (array)fetch_remote_file("$dummy_image_url/" . $catname . ".png");
717 717
 
718
-                if (empty($uploaded['error'])) {
719
-                    $new_path = $uploaded['file'];
720
-                    $new_url = $uploaded['url'];
721
-                }
718
+				if (empty($uploaded['error'])) {
719
+					$new_path = $uploaded['file'];
720
+					$new_url = $uploaded['url'];
721
+				}
722 722
 
723
-                $wp_filetype = wp_check_filetype(basename($new_path), null);
723
+				$wp_filetype = wp_check_filetype(basename($new_path), null);
724 724
 
725
-                $attachment = array(
726
-                    'guid' => $uploads['baseurl'] . '/' . basename($new_path),
727
-                    'post_mime_type' => $wp_filetype['type'],
728
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
729
-                    'post_content' => '',
730
-                    'post_status' => 'inherit'
731
-                );
725
+				$attachment = array(
726
+					'guid' => $uploads['baseurl'] . '/' . basename($new_path),
727
+					'post_mime_type' => $wp_filetype['type'],
728
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($new_path)),
729
+					'post_content' => '',
730
+					'post_status' => 'inherit'
731
+				);
732 732
 
733
-                $attach_id = wp_insert_attachment($attachment, $new_path);
733
+				$attach_id = wp_insert_attachment($attachment, $new_path);
734 734
 
735 735
 
736
-                // you must first include the image.php file
737
-                // for the function wp_generate_attachment_metadata() to work
738
-                require_once(ABSPATH . 'wp-admin/includes/image.php');
739
-                $attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
740
-                wp_update_attachment_metadata($attach_id, $attach_data);
736
+				// you must first include the image.php file
737
+				// for the function wp_generate_attachment_metadata() to work
738
+				require_once(ABSPATH . 'wp-admin/includes/image.php');
739
+				$attach_data = wp_generate_attachment_metadata($attach_id, $new_path);
740
+				wp_update_attachment_metadata($attach_id, $attach_data);
741 741
 
742
-                if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
743
-                    update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), 'gd_place');
744
-                }
745
-            }
746
-        }
742
+				if (!get_tax_meta($last_catid['term_id'], 'ct_cat_icon', false, 'gd_place')) {
743
+					update_tax_meta($last_catid['term_id'], 'ct_cat_icon', array('id' => $attach_id, 'src' => $new_url), 'gd_place');
744
+				}
745
+			}
746
+		}
747 747
 
748
-    }
748
+	}
749 749
 }
750 750
 
751 751
 /**
@@ -760,145 +760,145 @@  discard block
 block discarded – undo
760 760
  * @return bool Returns true if saved.
761 761
  */
762 762
 function geodir_update_options($options, $dummy = false) {
763
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
763
+	if ((!isset($_POST) || !$_POST) && !$dummy) return false;
764 764
 
765
-    foreach ($options as $value) {
766
-        if ($dummy && isset($value['std']))
767
-            $_POST[$value['id']] = $value['std'];
765
+	foreach ($options as $value) {
766
+		if ($dummy && isset($value['std']))
767
+			$_POST[$value['id']] = $value['std'];
768 768
 
769 769
 
770
-        if (isset($value['type']) && $value['type'] == 'checkbox') :
770
+		if (isset($value['type']) && $value['type'] == 'checkbox') :
771 771
 
772
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
773
-                update_option($value['id'], $_POST[$value['id']]);
774
-            } else {
775
-                update_option($value['id'], 0);
776
-            }
772
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
773
+				update_option($value['id'], $_POST[$value['id']]);
774
+			} else {
775
+				update_option($value['id'], 0);
776
+			}
777 777
 
778
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
778
+		elseif (isset($value['type']) && $value['type'] == 'image_width') :
779 779
 
780
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
781
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
782
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
783
-                if (isset($_POST[$value['id'] . '_crop'])) :
784
-                    update_option($value['id'] . '_crop', 1);
785
-                else :
786
-                    update_option($value['id'] . '_crop', 0);
787
-                endif;
788
-            } else {
789
-                update_option($value['id'] . '_width', $value['std']);
790
-                update_option($value['id'] . '_height', $value['std']);
791
-                update_option($value['id'] . '_crop', 1);
792
-            }
780
+			if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
781
+				update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
782
+				update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
783
+				if (isset($_POST[$value['id'] . '_crop'])) :
784
+					update_option($value['id'] . '_crop', 1);
785
+				else :
786
+					update_option($value['id'] . '_crop', 0);
787
+				endif;
788
+			} else {
789
+				update_option($value['id'] . '_width', $value['std']);
790
+				update_option($value['id'] . '_height', $value['std']);
791
+				update_option($value['id'] . '_crop', 1);
792
+			}
793 793
 
794
-        elseif (isset($value['type']) && $value['type'] == 'map') :
795
-            $post_types = array();
796
-            $categories = array();
797
-            $i = 0;
794
+		elseif (isset($value['type']) && $value['type'] == 'map') :
795
+			$post_types = array();
796
+			$categories = array();
797
+			$i = 0;
798 798
 
799
-            if (!empty($_POST['home_map_post_types'])) :
800
-                foreach ($_POST['home_map_post_types'] as $post_type) :
801
-                    $post_types[] = $post_type;
802
-                endforeach;
803
-            endif;
799
+			if (!empty($_POST['home_map_post_types'])) :
800
+				foreach ($_POST['home_map_post_types'] as $post_type) :
801
+					$post_types[] = $post_type;
802
+				endforeach;
803
+			endif;
804 804
 
805
-            update_option('geodir_exclude_post_type_on_map', $post_types);
805
+			update_option('geodir_exclude_post_type_on_map', $post_types);
806 806
 
807
-            if (!empty($_POST['post_category'])) :
808
-                foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
809
-                    $categories[$texonomy] = array();
810
-                    foreach ($cat_arr as $category) :
811
-                        $categories[$texonomy][] = $category;
812
-                    endforeach;
813
-                    $categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
814
-                endforeach;
815
-            endif;
816
-            update_option('geodir_exclude_cat_on_map', $categories);
817
-            update_option('geodir_exclude_cat_on_map_upgrade', 1);
818
-        elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
807
+			if (!empty($_POST['post_category'])) :
808
+				foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
809
+					$categories[$texonomy] = array();
810
+					foreach ($cat_arr as $category) :
811
+						$categories[$texonomy][] = $category;
812
+					endforeach;
813
+					$categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
814
+				endforeach;
815
+			endif;
816
+			update_option('geodir_exclude_cat_on_map', $categories);
817
+			update_option('geodir_exclude_cat_on_map_upgrade', 1);
818
+		elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
819 819
 
820 820
 
821
-            if (!empty($_POST['geodir_default_map_language'])):
822
-                update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
823
-            endif;
821
+			if (!empty($_POST['geodir_default_map_language'])):
822
+				update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
823
+			endif;
824 824
 
825 825
 
826
-            if (!empty($_POST['geodir_default_map_search_pt'])):
827
-                update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
828
-            endif;
826
+			if (!empty($_POST['geodir_default_map_search_pt'])):
827
+				update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
828
+			endif;
829 829
 
830 830
 
831
-        elseif (isset($value['type']) && $value['type'] == 'file') :
831
+		elseif (isset($value['type']) && $value['type'] == 'file') :
832 832
 
833 833
 
834
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
834
+			if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
835 835
 
836
-                if (get_option($value['id'])) {
837
-                    $image_name_arr = explode('/', get_option($value['id']));
838
-                    $noimg_name = end($image_name_arr);
839
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
840
-                    if (file_exists($img_path))
841
-                        unlink($img_path);
842
-                }
836
+				if (get_option($value['id'])) {
837
+					$image_name_arr = explode('/', get_option($value['id']));
838
+					$noimg_name = end($image_name_arr);
839
+					$img_path = $uploads['path'] . '/' . $noimg_name;
840
+					if (file_exists($img_path))
841
+						unlink($img_path);
842
+				}
843 843
 
844
-                update_option($value['id'], '');
845
-            }
844
+				update_option($value['id'], '');
845
+			}
846 846
 
847
-            $uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
848
-            $filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
849
-
850
-            if (!empty($filename)):
851
-                $ext = pathinfo($filename, PATHINFO_EXTENSION);
852
-                $uplaods = array();
853
-
854
-                foreach ($uploadedfile as $key => $uplaod):
855
-                    if ($key == 'name'):
856
-                        $uplaods[$key] = $filename;
857
-                    else :
858
-                        $uplaods[$key] = $uplaod;
859
-                    endif;
860
-                endforeach;
861
-
862
-                $uploads = wp_upload_dir();
863
-
864
-                if (get_option($value['id'])) {
865
-                    $image_name_arr = explode('/', get_option($value['id']));
866
-                    $noimg_name = end($image_name_arr);
867
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
868
-                    if (file_exists($img_path))
869
-                        unlink($img_path);
870
-                }
847
+			$uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
848
+			$filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
849
+
850
+			if (!empty($filename)):
851
+				$ext = pathinfo($filename, PATHINFO_EXTENSION);
852
+				$uplaods = array();
853
+
854
+				foreach ($uploadedfile as $key => $uplaod):
855
+					if ($key == 'name'):
856
+						$uplaods[$key] = $filename;
857
+					else :
858
+						$uplaods[$key] = $uplaod;
859
+					endif;
860
+				endforeach;
861
+
862
+				$uploads = wp_upload_dir();
863
+
864
+				if (get_option($value['id'])) {
865
+					$image_name_arr = explode('/', get_option($value['id']));
866
+					$noimg_name = end($image_name_arr);
867
+					$img_path = $uploads['path'] . '/' . $noimg_name;
868
+					if (file_exists($img_path))
869
+						unlink($img_path);
870
+				}
871 871
 
872
-                $upload_overrides = array('test_form' => false);
873
-                $movefile = wp_handle_upload($uplaods, $upload_overrides);
872
+				$upload_overrides = array('test_form' => false);
873
+				$movefile = wp_handle_upload($uplaods, $upload_overrides);
874 874
 
875
-                update_option($value['id'], $movefile['url']);
875
+				update_option($value['id'], $movefile['url']);
876 876
 
877
-            endif;
877
+			endif;
878 878
 
879
-            if (!get_option($value['id']) && isset($value['value'])):
880
-                update_option($value['id'], $value['value']);
881
-            endif;
879
+			if (!get_option($value['id']) && isset($value['value'])):
880
+				update_option($value['id'], $value['value']);
881
+			endif;
882 882
 
883 883
 
884
-        else :
885
-            // same menu setting per theme.
886
-            if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
887
-                $theme = wp_get_theme();
888
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
889
-            }
884
+		else :
885
+			// same menu setting per theme.
886
+			if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
887
+				$theme = wp_get_theme();
888
+				update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
889
+			}
890 890
 
891
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
892
-                update_option($value['id'], $_POST[$value['id']]);
893
-            } else {
894
-                delete_option($value['id']);
895
-            }
891
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
892
+				update_option($value['id'], $_POST[$value['id']]);
893
+			} else {
894
+				delete_option($value['id']);
895
+			}
896 896
 
897
-        endif;
898
-    }
899
-    if ($dummy)
900
-        $_POST = array();
901
-    return true;
897
+		endif;
898
+	}
899
+	if ($dummy)
900
+		$_POST = array();
901
+	return true;
902 902
 
903 903
 }
904 904
 
@@ -947,33 +947,33 @@  discard block
 block discarded – undo
947 947
 function places_custom_fields_tab($tabs)
948 948
 {
949 949
 
950
-    $geodir_post_types = get_option('geodir_post_types');
950
+	$geodir_post_types = get_option('geodir_post_types');
951 951
 
952
-    if (!empty($geodir_post_types)) {
952
+	if (!empty($geodir_post_types)) {
953 953
 
954
-        foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
954
+		foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
955 955
 
956
-            $listing_slug = $geodir_posttype_info['labels']['singular_name'];
956
+			$listing_slug = $geodir_posttype_info['labels']['singular_name'];
957 957
 
958
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
959
-                'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
960
-                'subtabs' => array(
961
-                    array('subtab' => 'custom_fields',
962
-                        'label' => __('Custom Fields', 'geodirectory'),
963
-                        'request' => array('listing_type' => $geodir_post_type)),
964
-                    array('subtab' => 'sorting_options',
965
-                        'label' => __('Sorting Options', 'geodirectory'),
966
-                        'request' => array('listing_type' => $geodir_post_type)),
967
-                ),
968
-                'tab_index' => 9,
969
-                'request' => array('listing_type' => $geodir_post_type)
970
-            );
958
+			$tabs[$geodir_post_type . '_fields_settings'] = array(
959
+				'label' => __(ucfirst($listing_slug) . ' Settings', 'geodirectory'),
960
+				'subtabs' => array(
961
+					array('subtab' => 'custom_fields',
962
+						'label' => __('Custom Fields', 'geodirectory'),
963
+						'request' => array('listing_type' => $geodir_post_type)),
964
+					array('subtab' => 'sorting_options',
965
+						'label' => __('Sorting Options', 'geodirectory'),
966
+						'request' => array('listing_type' => $geodir_post_type)),
967
+				),
968
+				'tab_index' => 9,
969
+				'request' => array('listing_type' => $geodir_post_type)
970
+			);
971 971
 
972
-        endforeach;
972
+		endforeach;
973 973
 
974
-    }
974
+	}
975 975
 
976
-    return $tabs;
976
+	return $tabs;
977 977
 }
978 978
 
979 979
 
@@ -989,8 +989,8 @@  discard block
 block discarded – undo
989 989
  */
990 990
 function geodir_tools_setting_tab($tabs)
991 991
 {
992
-    $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
993
-    return $tabs;
992
+	$tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
993
+	return $tabs;
994 994
 }
995 995
 
996 996
 /**
@@ -1005,8 +1005,8 @@  discard block
 block discarded – undo
1005 1005
  */
1006 1006
 function geodir_compatibility_setting_tab($tabs)
1007 1007
 {
1008
-    $tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
1009
-    return $tabs;
1008
+	$tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
1009
+	return $tabs;
1010 1010
 }
1011 1011
 
1012 1012
 
@@ -1022,144 +1022,144 @@  discard block
 block discarded – undo
1022 1022
  */
1023 1023
 function geodir_extend_geodirectory_setting_tab($tabs)
1024 1024
 {
1025
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1026
-    return $tabs;
1025
+	$tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'http://wpgeodirectory.com', 'target' => '_blank');
1026
+	return $tabs;
1027 1027
 }
1028 1028
 
1029 1029
 
1030 1030
 if (!function_exists('geodir_edit_post_columns')) {
1031
-    /**
1032
-     * Modify admin post listing page columns.
1033
-     *
1034
-     * @since 1.0.0
1035
-     * @package GeoDirectory
1036
-     * @param array $columns The column array.
1037
-     * @return array Altered column array.
1038
-     */
1039
-    function geodir_edit_post_columns($columns)
1040
-    {
1041
-
1042
-        $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1043
-            'categorys' => __('Categories', 'geodirectory'));
1044
-
1045
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1046
-        {
1047
-            $offset = 0; // should we prepend $array with $data?
1048
-            $offset = count($columns); // or should we append $array with $data? lets pick this one...
1049
-        }
1031
+	/**
1032
+	 * Modify admin post listing page columns.
1033
+	 *
1034
+	 * @since 1.0.0
1035
+	 * @package GeoDirectory
1036
+	 * @param array $columns The column array.
1037
+	 * @return array Altered column array.
1038
+	 */
1039
+	function geodir_edit_post_columns($columns)
1040
+	{
1041
+
1042
+		$new_columns = array('location' => __('Location (ID)', 'geodirectory'),
1043
+			'categorys' => __('Categories', 'geodirectory'));
1050 1044
 
1051
-        $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1045
+		if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
1046
+		{
1047
+			$offset = 0; // should we prepend $array with $data?
1048
+			$offset = count($columns); // or should we append $array with $data? lets pick this one...
1049
+		}
1052 1050
 
1053
-        $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
1051
+		$columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
1054 1052
 
1055
-        return $columns;
1056
-    }
1053
+		$columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
1054
+
1055
+		return $columns;
1056
+	}
1057 1057
 }
1058 1058
 
1059 1059
 
1060 1060
 if (!function_exists('geodir_manage_post_columns')) {
1061
-    /**
1062
-     * Adds content to our custom post listing page columns.
1063
-     *
1064
-     * @since 1.0.0
1065
-     * @package GeoDirectory
1066
-     * @global object $wpdb WordPress Database object.
1067
-     * @global object $post WordPress Post object.
1068
-     * @param string $column The column name.
1069
-     * @param int $post_id The post ID.
1070
-     */
1071
-    function geodir_manage_post_columns($column, $post_id)
1072
-    {
1073
-        global $post, $wpdb;
1074
-
1075
-        switch ($column):
1076
-            /* If displaying the 'city' column. */
1077
-            case 'location' :
1078
-                $location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
1079
-                $location = geodir_get_location($location_id);
1080
-                /* If no city is found, output a default message. */
1081
-                if (empty($location)) {
1082
-                    _e('Unknown', 'geodirectory');
1083
-                } else {
1084
-                    /* If there is a city id, append 'city name' to the text string. */
1085
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1086
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1087
-                }
1088
-                break;
1089
-
1090
-            /* If displaying the 'expire' column. */
1091
-            case 'expire' :
1092
-                $expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
1093
-                $d1 = $expire_date; // get expire_date
1094
-                $d2 = date('Y-m-d'); // get current date
1095
-                $state = __('days left', 'geodirectory');
1096
-                $date_diff_text = '';
1097
-                $expire_class = 'expire_left';
1098
-                if ($expire_date != 'Never') {
1099
-                    if (strtotime($d1) < strtotime($d2)) {
1100
-                        $state = __('days overdue', 'geodirectory');
1101
-                        $expire_class = 'expire_over';
1102
-                    }
1103
-                    $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the differance in days
1104
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1105
-                }
1106
-                /* If no expire_date is found, output a default message. */
1107
-                if (empty($expire_date))
1108
-                    echo __('Unknown', 'geodirectory');
1109
-                /* If there is a expire_date, append 'days left' to the text string. */
1110
-                else
1111
-                    echo $expire_date . $date_diff_text;
1112
-                break;
1113
-
1114
-            /* If displaying the 'categorys' column. */
1115
-            case 'categorys' :
1116
-
1117
-                /* Get the categorys for the post. */
1118
-
1119
-
1120
-                $terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
1121
-
1122
-                /* If terms were found. */
1123
-                if (!empty($terms)) {
1124
-                    $out = array();
1125
-                    /* Loop through each term, linking to the 'edit posts' page for the specific term. */
1126
-                    foreach ($terms as $term) {
1127
-                        if (!strstr($term->taxonomy, 'tag')) {
1128
-                            $out[] = sprintf('<a href="%s">%s</a>',
1129
-                                esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
1130
-                                esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
1131
-                            );
1132
-                        }
1133
-                    }
1134
-                    /* Join the terms, separating them with a comma. */
1135
-                    echo(join(', ', $out));
1136
-                } /* If no terms were found, output a default message. */
1137
-                else {
1138
-                    _e('No Categories', 'geodirectory');
1139
-                }
1140
-                break;
1061
+	/**
1062
+	 * Adds content to our custom post listing page columns.
1063
+	 *
1064
+	 * @since 1.0.0
1065
+	 * @package GeoDirectory
1066
+	 * @global object $wpdb WordPress Database object.
1067
+	 * @global object $post WordPress Post object.
1068
+	 * @param string $column The column name.
1069
+	 * @param int $post_id The post ID.
1070
+	 */
1071
+	function geodir_manage_post_columns($column, $post_id)
1072
+	{
1073
+		global $post, $wpdb;
1074
+
1075
+		switch ($column):
1076
+			/* If displaying the 'city' column. */
1077
+			case 'location' :
1078
+				$location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
1079
+				$location = geodir_get_location($location_id);
1080
+				/* If no city is found, output a default message. */
1081
+				if (empty($location)) {
1082
+					_e('Unknown', 'geodirectory');
1083
+				} else {
1084
+					/* If there is a city id, append 'city name' to the text string. */
1085
+					$add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
1086
+					echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
1087
+				}
1088
+				break;
1089
+
1090
+			/* If displaying the 'expire' column. */
1091
+			case 'expire' :
1092
+				$expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
1093
+				$d1 = $expire_date; // get expire_date
1094
+				$d2 = date('Y-m-d'); // get current date
1095
+				$state = __('days left', 'geodirectory');
1096
+				$date_diff_text = '';
1097
+				$expire_class = 'expire_left';
1098
+				if ($expire_date != 'Never') {
1099
+					if (strtotime($d1) < strtotime($d2)) {
1100
+						$state = __('days overdue', 'geodirectory');
1101
+						$expire_class = 'expire_over';
1102
+					}
1103
+					$date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the differance in days
1104
+					$date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
1105
+				}
1106
+				/* If no expire_date is found, output a default message. */
1107
+				if (empty($expire_date))
1108
+					echo __('Unknown', 'geodirectory');
1109
+				/* If there is a expire_date, append 'days left' to the text string. */
1110
+				else
1111
+					echo $expire_date . $date_diff_text;
1112
+				break;
1141 1113
 
1142
-        endswitch;
1143
-    }
1114
+			/* If displaying the 'categorys' column. */
1115
+			case 'categorys' :
1116
+
1117
+				/* Get the categorys for the post. */
1118
+
1119
+
1120
+				$terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
1121
+
1122
+				/* If terms were found. */
1123
+				if (!empty($terms)) {
1124
+					$out = array();
1125
+					/* Loop through each term, linking to the 'edit posts' page for the specific term. */
1126
+					foreach ($terms as $term) {
1127
+						if (!strstr($term->taxonomy, 'tag')) {
1128
+							$out[] = sprintf('<a href="%s">%s</a>',
1129
+								esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
1130
+								esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
1131
+							);
1132
+						}
1133
+					}
1134
+					/* Join the terms, separating them with a comma. */
1135
+					echo(join(', ', $out));
1136
+				} /* If no terms were found, output a default message. */
1137
+				else {
1138
+					_e('No Categories', 'geodirectory');
1139
+				}
1140
+				break;
1141
+
1142
+		endswitch;
1143
+	}
1144 1144
 }
1145 1145
 
1146 1146
 
1147 1147
 if (!function_exists('geodir_post_sortable_columns')) {
1148
-    /**
1149
-     * Makes admin post listing page columns sortable.
1150
-     *
1151
-     * @since 1.0.0
1152
-     * @package GeoDirectory
1153
-     * @param array $columns The column array.
1154
-     * @return array Altered column array.
1155
-     */
1156
-    function geodir_post_sortable_columns($columns)
1157
-    {
1158
-
1159
-        $columns['expire'] = 'expire';
1160
-
1161
-        return $columns;
1162
-    }
1148
+	/**
1149
+	 * Makes admin post listing page columns sortable.
1150
+	 *
1151
+	 * @since 1.0.0
1152
+	 * @package GeoDirectory
1153
+	 * @param array $columns The column array.
1154
+	 * @return array Altered column array.
1155
+	 */
1156
+	function geodir_post_sortable_columns($columns)
1157
+	{
1158
+
1159
+		$columns['expire'] = 'expire';
1160
+
1161
+		return $columns;
1162
+	}
1163 1163
 }
1164 1164
 
1165 1165
 /**
@@ -1173,32 +1173,32 @@  discard block
 block discarded – undo
1173 1173
  * @param int $post_id The post ID.
1174 1174
  */
1175 1175
 function geodir_post_information_save($post_id, $post) {
1176
-    global $wpdb, $current_user;
1176
+	global $wpdb, $current_user;
1177 1177
 
1178
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1179
-        return;
1180
-    }
1178
+	if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
1179
+		return;
1180
+	}
1181 1181
 
1182
-    $geodir_posttypes = geodir_get_posttypes();
1182
+	$geodir_posttypes = geodir_get_posttypes();
1183 1183
 
1184
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1185
-        return;
1184
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
1185
+		return;
1186 1186
 
1187
-    if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1188
-        if (isset($_REQUEST['_status']))
1189
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
1187
+	if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
1188
+		if (isset($_REQUEST['_status']))
1189
+			geodir_change_post_status($post_id, $_REQUEST['_status']);
1190 1190
 
1191
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1192
-            return;
1191
+		if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
1192
+			return;
1193 1193
 
1194
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1195
-            return;
1194
+		if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
1195
+			return;
1196 1196
 
1197
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1198
-            return;
1197
+		if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
1198
+			return;
1199 1199
 
1200
-        geodir_save_listing($_REQUEST);
1201
-    }
1200
+		geodir_save_listing($_REQUEST);
1201
+	}
1202 1202
 }
1203 1203
 
1204 1204
 /**
@@ -1214,102 +1214,102 @@  discard block
 block discarded – undo
1214 1214
  */
1215 1215
 function geodir_admin_fields($options)
1216 1216
 {
1217
-    global $geodirectory;
1218
-
1219
-    $first_title = true;
1220
-    $tab_id = '';
1221
-    $i = 0;
1222
-    foreach ($options as $value) :
1223
-        if (!isset($value['name'])) $value['name'] = '';
1224
-        if (!isset($value['class'])) $value['class'] = '';
1225
-        if (!isset($value['css'])) $value['css'] = '';
1226
-        if (!isset($value['std'])) $value['std'] = '';
1227
-        $desc = '';
1228
-        switch ($value['type']) :
1229
-            case 'dummy_installer':
1230
-                $post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
1231
-                geodir_autoinstall_admin_header($post_type);
1232
-                break;
1233
-            case 'title':
1234
-
1235
-                if ($i == 0) {
1236
-                    echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
1237
-                    echo '<div class="inner_content_tab_main">';
1238
-                }
1217
+	global $geodirectory;
1218
+
1219
+	$first_title = true;
1220
+	$tab_id = '';
1221
+	$i = 0;
1222
+	foreach ($options as $value) :
1223
+		if (!isset($value['name'])) $value['name'] = '';
1224
+		if (!isset($value['class'])) $value['class'] = '';
1225
+		if (!isset($value['css'])) $value['css'] = '';
1226
+		if (!isset($value['std'])) $value['std'] = '';
1227
+		$desc = '';
1228
+		switch ($value['type']) :
1229
+			case 'dummy_installer':
1230
+				$post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
1231
+				geodir_autoinstall_admin_header($post_type);
1232
+				break;
1233
+			case 'title':
1234
+
1235
+				if ($i == 0) {
1236
+					echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
1237
+					echo '<div class="inner_content_tab_main">';
1238
+				}
1239 1239
 
1240
-                $i++;
1240
+				$i++;
1241 1241
 
1242
-                if (isset($value['id']) && $value['id'])
1243
-                    $tab_id = $value['id'];
1242
+				if (isset($value['id']) && $value['id'])
1243
+					$tab_id = $value['id'];
1244 1244
 
1245
-                if (isset($value['desc']) && $value['desc'])
1246
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1245
+				if (isset($value['desc']) && $value['desc'])
1246
+					$desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
1247 1247
 
1248
-                if (isset($value['name']) && $value['name']) {
1249
-                    if ($first_title === true) {
1250
-                        $first_title = false;
1251
-                    } else {
1252
-                        echo '</div>';
1253
-                    }
1254
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
1248
+				if (isset($value['name']) && $value['name']) {
1249
+					if ($first_title === true) {
1250
+						$first_title = false;
1251
+					} else {
1252
+						echo '</div>';
1253
+					}
1254
+					echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
1255 1255
 
1256
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1257
-                }
1256
+					echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1257
+				}
1258 1258
 
1259
-                /**
1260
-                 * Called after a GeoDirectory settings title is output in the GD settings page.
1261
-                 *
1262
-                 * The action is called dynamically geodir_settings_$value['id'].
1263
-                 *
1264
-                 * @since 1.0.0
1265
-                 */
1266
-                do_action('geodir_settings_' . sanitize_title($value['id']));
1267
-                break;
1268
-
1269
-            case 'no_tabs':
1270
-
1271
-                echo '<div class="inner_content_tab_main">';
1272
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1273
-
1274
-                break;
1275
-
1276
-            case 'sectionstart':
1277
-                if (isset($value['desc']) && $value['desc'])
1278
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1279
-                if (isset($value['name']) && $value['name'])
1280
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1281
-                /**
1282
-                 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1283
-                 *
1284
-                 * The action is called dynamically geodir_settings_$value['id']_start.
1285
-                 *
1286
-                 * @since 1.0.0
1287
-                 */
1288
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1289
-                echo '<table class="form-table">' . "\n\n";
1290
-
1291
-                break;
1292
-            case 'sectionend':
1293
-                /**
1294
-                 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
1295
-                 *
1296
-                 * The action is called dynamically geodir_settings_$value['id']_end.
1297
-                 *
1298
-                 * @since 1.0.0
1299
-                 */
1300
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1301
-                echo '</table>';
1302
-                /**
1303
-                 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
1304
-                 *
1305
-                 * The action is called dynamically geodir_settings_$value['id']_end.
1306
-                 *
1307
-                 * @since 1.0.0
1308
-                 */
1309
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1310
-                break;
1311
-            case 'text':
1312
-                ?>
1259
+				/**
1260
+				 * Called after a GeoDirectory settings title is output in the GD settings page.
1261
+				 *
1262
+				 * The action is called dynamically geodir_settings_$value['id'].
1263
+				 *
1264
+				 * @since 1.0.0
1265
+				 */
1266
+				do_action('geodir_settings_' . sanitize_title($value['id']));
1267
+				break;
1268
+
1269
+			case 'no_tabs':
1270
+
1271
+				echo '<div class="inner_content_tab_main">';
1272
+				echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
1273
+
1274
+				break;
1275
+
1276
+			case 'sectionstart':
1277
+				if (isset($value['desc']) && $value['desc'])
1278
+					$desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1279
+				if (isset($value['name']) && $value['name'])
1280
+					echo '<h3>' . $value['name'] . $desc . '</h3>';
1281
+				/**
1282
+				 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
1283
+				 *
1284
+				 * The action is called dynamically geodir_settings_$value['id']_start.
1285
+				 *
1286
+				 * @since 1.0.0
1287
+				 */
1288
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1289
+				echo '<table class="form-table">' . "\n\n";
1290
+
1291
+				break;
1292
+			case 'sectionend':
1293
+				/**
1294
+				 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
1295
+				 *
1296
+				 * The action is called dynamically geodir_settings_$value['id']_end.
1297
+				 *
1298
+				 * @since 1.0.0
1299
+				 */
1300
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1301
+				echo '</table>';
1302
+				/**
1303
+				 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
1304
+				 *
1305
+				 * The action is called dynamically geodir_settings_$value['id']_end.
1306
+				 *
1307
+				 * @since 1.0.0
1308
+				 */
1309
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1310
+				break;
1311
+			case 'text':
1312
+				?>
1313 1313
                 <tr valign="top">
1314 1314
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1315 1315
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1318,15 +1318,15 @@  discard block
 block discarded – undo
1318 1318
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1319 1319
                                            style=" <?php echo esc_attr($value['css']); ?>"
1320 1320
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1321
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1322
-                                           } else {
1323
-                                               echo esc_attr($value['std']);
1324
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1321
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1322
+										   } else {
1323
+											   echo esc_attr($value['std']);
1324
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1325 1325
                 </tr><?php
1326
-                break;
1326
+				break;
1327 1327
 
1328
-            case 'password':
1329
-                ?>
1328
+			case 'password':
1329
+				?>
1330 1330
                 <tr valign="top">
1331 1331
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1332 1332
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1335,42 +1335,42 @@  discard block
 block discarded – undo
1335 1335
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1336 1336
                                            style="<?php echo esc_attr($value['css']); ?>"
1337 1337
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1338
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1339
-                                           } else {
1340
-                                               echo esc_attr($value['std']);
1341
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1338
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1339
+										   } else {
1340
+											   echo esc_attr($value['std']);
1341
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1342 1342
                 </tr><?php
1343
-                break;
1343
+				break;
1344 1344
 
1345
-            case 'html_content':
1346
-                ?>
1345
+			case 'html_content':
1346
+				?>
1347 1347
                 <tr valign="top">
1348 1348
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1349 1349
                 <td class="forminp"><span class="description"><?php echo $value['desc']; ?></span></td>
1350 1350
                 </tr><?php
1351
-                break;
1351
+				break;
1352 1352
 
1353
-            case 'color' :
1354
-                ?>
1353
+			case 'color' :
1354
+				?>
1355 1355
                 <tr valign="top">
1356 1356
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1357 1357
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1358 1358
                                            id="<?php echo esc_attr($value['id']); ?>" type="text"
1359 1359
                                            style="<?php echo esc_attr($value['css']); ?>"
1360 1360
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1361
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1362
-                                           } else {
1363
-                                               echo esc_attr($value['std']);
1364
-                                           } ?>" class="colorpick"/> <span
1361
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1362
+										   } else {
1363
+											   echo esc_attr($value['std']);
1364
+										   } ?>" class="colorpick"/> <span
1365 1365
                         class="description"><?php echo $value['desc']; ?></span>
1366 1366
 
1367 1367
                     <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv"
1368 1368
                          style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>
1369 1369
                 </td>
1370 1370
                 </tr><?php
1371
-                break;
1372
-            case 'image_width' :
1373
-                ?>
1371
+				break;
1372
+			case 'image_width' :
1373
+				?>
1374 1374
                 <tr valign="top">
1375 1375
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1376 1376
                 <td class="forminp">
@@ -1392,11 +1392,11 @@  discard block
 block discarded – undo
1392 1392
 
1393 1393
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1394 1394
                 </tr><?php
1395
-                break;
1396
-            case 'select':
1397
-                $option_value = get_option($value['id']);
1398
-                $option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1399
-                ?>
1395
+				break;
1396
+			case 'select':
1397
+				$option_value = get_option($value['id']);
1398
+				$option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1399
+				?>
1400 1400
                 <tr valign="top">
1401 1401
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1402 1402
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1405,33 +1405,33 @@  discard block
 block discarded – undo
1405 1405
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1406 1406
                                             option-ajaxchosen="false">
1407 1407
                         <?php
1408
-                        foreach ($value['options'] as $key => $val) {
1409
-                            $geodir_select_value = '';
1410
-                            if ($option_value != '') {
1411
-                                if ($option_value != '' && $option_value == $key)
1412
-                                    $geodir_select_value = ' selected="selected" ';
1413
-                            } else {
1414
-                                if ($value['std'] == $key)
1415
-                                    $geodir_select_value = ' selected="selected" ';
1416
-                            }
1417
-                            ?>
1408
+						foreach ($value['options'] as $key => $val) {
1409
+							$geodir_select_value = '';
1410
+							if ($option_value != '') {
1411
+								if ($option_value != '' && $option_value == $key)
1412
+									$geodir_select_value = ' selected="selected" ';
1413
+							} else {
1414
+								if ($value['std'] == $key)
1415
+									$geodir_select_value = ' selected="selected" ';
1416
+							}
1417
+							?>
1418 1418
                             <option
1419 1419
                                 value="<?php echo esc_attr($key); ?>" <?php echo $geodir_select_value; ?> ><?php echo ucfirst($val) ?></option>
1420 1420
                         <?php
1421
-                        }
1422
-                        ?>
1421
+						}
1422
+						?>
1423 1423
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1424 1424
                 </td>
1425 1425
                 </tr><?php
1426
-                break;
1426
+				break;
1427 1427
 
1428
-            case 'multiselect':
1429
-                $option_values = get_option($value['id']);
1430
-                if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1431
-                   $option_values = $value['std'];
1432
-                }
1433
-                $option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1434
-                ?>
1428
+			case 'multiselect':
1429
+				$option_values = get_option($value['id']);
1430
+				if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1431
+				   $option_values = $value['std'];
1432
+				}
1433
+				$option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1434
+				?>
1435 1435
                 <tr valign="top">
1436 1436
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1437 1437
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
@@ -1441,25 +1441,25 @@  discard block
 block discarded – undo
1441 1441
                                             data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1442 1442
                                             option-ajaxchosen="false">
1443 1443
                         <?php
1444
-                        foreach ($value['options'] as $key => $val) {
1445
-                            if (strpos($key, 'optgroup_start-') === 0) {
1446
-                                ?><optgroup label="<?php echo ucfirst($val); ?>"><?php
1447
-                            } else if (strpos($key, 'optgroup_end-') === 0) {
1448
-                                ?></optgroup><?php
1449
-                            } else {
1450
-                                ?>
1444
+						foreach ($value['options'] as $key => $val) {
1445
+							if (strpos($key, 'optgroup_start-') === 0) {
1446
+								?><optgroup label="<?php echo ucfirst($val); ?>"><?php
1447
+							} else if (strpos($key, 'optgroup_end-') === 0) {
1448
+								?></optgroup><?php
1449
+							} else {
1450
+								?>
1451 1451
                                 <option
1452 1452
                                     value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>><?php echo ucfirst($val) ?></option>
1453 1453
                             <?php
1454
-                            }
1455
-                        }
1456
-                        ?>
1454
+							}
1455
+						}
1456
+						?>
1457 1457
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1458 1458
                 </td>
1459 1459
                 </tr><?php
1460
-                break;
1461
-            case 'file':
1462
-                ?>
1460
+				break;
1461
+			case 'file':
1462
+				?>
1463 1463
                 <tr valign="top">
1464 1464
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1465 1465
                 <td class="forminp">
@@ -1479,87 +1479,87 @@  discard block
 block discarded – undo
1479 1479
                     <?php } ?>
1480 1480
                 </td>
1481 1481
                 </tr><?php
1482
-                break;
1483
-            case 'map_default_settings' :
1484
-                ?>
1482
+				break;
1483
+			case 'map_default_settings' :
1484
+				?>
1485 1485
 
1486 1486
                 <tr valign="top">
1487 1487
                     <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1488 1488
                     <td width="60%">
1489 1489
                         <select name="geodir_default_map_language" style="width:60%">
1490 1490
                             <?php
1491
-                            $arr_map_langages = array(
1492
-                                'ar' => __('ARABIC', 'geodirectory'),
1493
-                                'eu' => __('BASQUE', 'geodirectory'),
1494
-                                'bg' => __('BULGARIAN', 'geodirectory'),
1495
-                                'bn' => __('BENGALI', 'geodirectory'),
1496
-                                'ca' => __('CATALAN', 'geodirectory'),
1497
-                                'cs' => __('CZECH', 'geodirectory'),
1498
-                                'da' => __('DANISH', 'geodirectory'),
1499
-                                'de' => __('GERMAN', 'geodirectory'),
1500
-                                'el' => __('GREEK', 'geodirectory'),
1501
-                                'en' => __('ENGLISH', 'geodirectory'),
1502
-                                'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1503
-                                'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1504
-                                'es' => __('SPANISH', 'geodirectory'),
1505
-                                'eu' => __('BASQUE', 'geodirectory'),
1506
-                                'fa' => __('FARSI', 'geodirectory'),
1507
-                                'fi' => __('FINNISH', 'geodirectory'),
1508
-                                'fil' => __('FILIPINO', 'geodirectory'),
1509
-                                'fr' => __('FRENCH', 'geodirectory'),
1510
-                                'gl' => __('GALICIAN', 'geodirectory'),
1511
-                                'gu' => __('GUJARATI', 'geodirectory'),
1512
-                                'hi' => __('HINDI', 'geodirectory'),
1513
-                                'hr' => __('CROATIAN', 'geodirectory'),
1514
-                                'hu' => __('HUNGARIAN', 'geodirectory'),
1515
-                                'id' => __('INDONESIAN', 'geodirectory'),
1516
-                                'it' => __('ITALIAN', 'geodirectory'),
1517
-                                'iw' => __('HEBREW', 'geodirectory'),
1518
-                                'ja' => __('JAPANESE', 'geodirectory'),
1519
-                                'kn' => __('KANNADA', 'geodirectory'),
1520
-                                'ko' => __('KOREAN', 'geodirectory'),
1521
-                                'lt' => __('LITHUANIAN', 'geodirectory'),
1522
-                                'lv' => __('LATVIAN', 'geodirectory'),
1523
-                                'ml' => __('MALAYALAM', 'geodirectory'),
1524
-                                'mr' => __('MARATHI', 'geodirectory'),
1525
-                                'nl' => __('DUTCH', 'geodirectory'),
1526
-                                'no' => __('NORWEGIAN', 'geodirectory'),
1527
-                                'pl' => __('POLISH', 'geodirectory'),
1528
-                                'pt' => __('PORTUGUESE', 'geodirectory'),
1529
-                                'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1530
-                                'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1531
-                                'ro' => __('ROMANIAN', 'geodirectory'),
1532
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1533
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1534
-                                'sk' => __('SLOVAK', 'geodirectory'),
1535
-                                'sl' => __('SLOVENIAN', 'geodirectory'),
1536
-                                'sr' => __('SERBIAN', 'geodirectory'),
1537
-                                'sv' => __('	SWEDISH', 'geodirectory'),
1538
-                                'tl' => __('TAGALOG', 'geodirectory'),
1539
-                                'ta' => __('TAMIL', 'geodirectory'),
1540
-                                'te' => __('TELUGU', 'geodirectory'),
1541
-                                'th' => __('THAI', 'geodirectory'),
1542
-                                'tr' => __('TURKISH', 'geodirectory'),
1543
-                                'uk' => __('UKRAINIAN', 'geodirectory'),
1544
-                                'vi' => __('VIETNAMESE', 'geodirectory'),
1545
-                                'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1546
-                                'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1547
-                            );
1548
-                            $geodir_default_map_language = get_option('geodir_default_map_language');
1549
-                            if (empty($geodir_default_map_language))
1550
-                                $geodir_default_map_language = 'en';
1551
-                            foreach ($arr_map_langages as $language_key => $language_txt) {
1552
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1553
-                                    $geodir_default_language_selected = "selected='selected'";
1554
-                                else
1555
-                                    $geodir_default_language_selected = '';
1556
-
1557
-                                ?>
1491
+							$arr_map_langages = array(
1492
+								'ar' => __('ARABIC', 'geodirectory'),
1493
+								'eu' => __('BASQUE', 'geodirectory'),
1494
+								'bg' => __('BULGARIAN', 'geodirectory'),
1495
+								'bn' => __('BENGALI', 'geodirectory'),
1496
+								'ca' => __('CATALAN', 'geodirectory'),
1497
+								'cs' => __('CZECH', 'geodirectory'),
1498
+								'da' => __('DANISH', 'geodirectory'),
1499
+								'de' => __('GERMAN', 'geodirectory'),
1500
+								'el' => __('GREEK', 'geodirectory'),
1501
+								'en' => __('ENGLISH', 'geodirectory'),
1502
+								'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1503
+								'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1504
+								'es' => __('SPANISH', 'geodirectory'),
1505
+								'eu' => __('BASQUE', 'geodirectory'),
1506
+								'fa' => __('FARSI', 'geodirectory'),
1507
+								'fi' => __('FINNISH', 'geodirectory'),
1508
+								'fil' => __('FILIPINO', 'geodirectory'),
1509
+								'fr' => __('FRENCH', 'geodirectory'),
1510
+								'gl' => __('GALICIAN', 'geodirectory'),
1511
+								'gu' => __('GUJARATI', 'geodirectory'),
1512
+								'hi' => __('HINDI', 'geodirectory'),
1513
+								'hr' => __('CROATIAN', 'geodirectory'),
1514
+								'hu' => __('HUNGARIAN', 'geodirectory'),
1515
+								'id' => __('INDONESIAN', 'geodirectory'),
1516
+								'it' => __('ITALIAN', 'geodirectory'),
1517
+								'iw' => __('HEBREW', 'geodirectory'),
1518
+								'ja' => __('JAPANESE', 'geodirectory'),
1519
+								'kn' => __('KANNADA', 'geodirectory'),
1520
+								'ko' => __('KOREAN', 'geodirectory'),
1521
+								'lt' => __('LITHUANIAN', 'geodirectory'),
1522
+								'lv' => __('LATVIAN', 'geodirectory'),
1523
+								'ml' => __('MALAYALAM', 'geodirectory'),
1524
+								'mr' => __('MARATHI', 'geodirectory'),
1525
+								'nl' => __('DUTCH', 'geodirectory'),
1526
+								'no' => __('NORWEGIAN', 'geodirectory'),
1527
+								'pl' => __('POLISH', 'geodirectory'),
1528
+								'pt' => __('PORTUGUESE', 'geodirectory'),
1529
+								'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1530
+								'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1531
+								'ro' => __('ROMANIAN', 'geodirectory'),
1532
+								'ru' => __('RUSSIAN', 'geodirectory'),
1533
+								'ru' => __('RUSSIAN', 'geodirectory'),
1534
+								'sk' => __('SLOVAK', 'geodirectory'),
1535
+								'sl' => __('SLOVENIAN', 'geodirectory'),
1536
+								'sr' => __('SERBIAN', 'geodirectory'),
1537
+								'sv' => __('	SWEDISH', 'geodirectory'),
1538
+								'tl' => __('TAGALOG', 'geodirectory'),
1539
+								'ta' => __('TAMIL', 'geodirectory'),
1540
+								'te' => __('TELUGU', 'geodirectory'),
1541
+								'th' => __('THAI', 'geodirectory'),
1542
+								'tr' => __('TURKISH', 'geodirectory'),
1543
+								'uk' => __('UKRAINIAN', 'geodirectory'),
1544
+								'vi' => __('VIETNAMESE', 'geodirectory'),
1545
+								'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1546
+								'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1547
+							);
1548
+							$geodir_default_map_language = get_option('geodir_default_map_language');
1549
+							if (empty($geodir_default_map_language))
1550
+								$geodir_default_map_language = 'en';
1551
+							foreach ($arr_map_langages as $language_key => $language_txt) {
1552
+								if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1553
+									$geodir_default_language_selected = "selected='selected'";
1554
+								else
1555
+									$geodir_default_language_selected = '';
1556
+
1557
+								?>
1558 1558
                                 <option
1559 1559
                                     value="<?php echo $language_key?>" <?php echo $geodir_default_language_selected; ?>><?php echo $language_txt; ?></option>
1560 1560
 
1561 1561
                             <?php }
1562
-                            ?>
1562
+							?>
1563 1563
                         </select>
1564 1564
                     </td>
1565 1565
                 </tr>
@@ -1570,46 +1570,46 @@  discard block
 block discarded – undo
1570 1570
                     <td width="60%">
1571 1571
                         <select name="geodir_default_map_search_pt" style="width:60%">
1572 1572
                             <?php
1573
-                            $post_types = geodir_get_posttypes('array');
1574
-                            $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1575
-                            if (empty($geodir_default_map_search_pt))
1576
-                                $geodir_default_map_search_pt = 'gd_place';
1577
-                            if (is_array($post_types)) {
1578
-                                foreach ($post_types as $key => $post_types_obj) {
1579
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1580
-                                        $geodir_search_pt_selected = "selected='selected'";
1581
-                                    else
1582
-                                        $geodir_search_pt_selected = '';
1583
-
1584
-                                    ?>
1573
+							$post_types = geodir_get_posttypes('array');
1574
+							$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1575
+							if (empty($geodir_default_map_search_pt))
1576
+								$geodir_default_map_search_pt = 'gd_place';
1577
+							if (is_array($post_types)) {
1578
+								foreach ($post_types as $key => $post_types_obj) {
1579
+									if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1580
+										$geodir_search_pt_selected = "selected='selected'";
1581
+									else
1582
+										$geodir_search_pt_selected = '';
1583
+
1584
+									?>
1585 1585
                                     <option
1586 1586
                                         value="<?php echo $key?>" <?php echo $geodir_search_pt_selected; ?>><?php echo $post_types_obj['labels']['singular_name']; ?></option>
1587 1587
 
1588 1588
                                 <?php }
1589 1589
 
1590
-                            }
1590
+							}
1591 1591
 
1592
-                            ?>
1592
+							?>
1593 1593
                         </select>
1594 1594
                     </td>
1595 1595
                 </tr>
1596 1596
 
1597 1597
                 <?php
1598
-                break;
1598
+				break;
1599 1599
 
1600
-            case 'map':
1601
-                ?>
1600
+			case 'map':
1601
+				?>
1602 1602
                 <tr valign="top">
1603 1603
                     <td class="forminp">
1604 1604
                         <?php
1605
-                        global $post_cat, $cat_display;
1606
-                        $post_types = geodir_get_posttypes('object');
1607
-                        $cat_display = 'checkbox';
1608
-                        $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1609
-                        $gd_cats = get_option('geodir_exclude_cat_on_map');
1610
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1611
-                        $count = 1;
1612
-                        ?>
1605
+						global $post_cat, $cat_display;
1606
+						$post_types = geodir_get_posttypes('object');
1607
+						$cat_display = 'checkbox';
1608
+						$gd_post_types = get_option('geodir_exclude_post_type_on_map');
1609
+						$gd_cats = get_option('geodir_exclude_cat_on_map');
1610
+						$gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1611
+						$count = 1;
1612
+						?>
1613 1613
                         <table width="70%" class="widefat">
1614 1614
                             <thead>
1615 1615
                             <tr>
@@ -1618,18 +1618,18 @@  discard block
 block discarded – undo
1618 1618
                                 <th><b><?php echo DESIGN_POST_TYPE_CAT; ?></b></th>
1619 1619
                             </tr>
1620 1620
                             <?php
1621
-                            $gd_categs = $gd_cats;
1622
-                            foreach ($post_types as $key => $post_types_obj) :
1623
-                                $checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1624
-                                $gd_taxonomy = geodir_get_taxonomies($key);
1625
-                                if ($gd_cats_upgrade) {
1626
-                                    $gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1627
-                                    $gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1628
-                                    $gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1629
-                                }
1630
-                                $post_cat = implode(',', $gd_cats);
1631
-                                $gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1632
-                                ?>
1621
+							$gd_categs = $gd_cats;
1622
+							foreach ($post_types as $key => $post_types_obj) :
1623
+								$checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1624
+								$gd_taxonomy = geodir_get_taxonomies($key);
1625
+								if ($gd_cats_upgrade) {
1626
+									$gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1627
+									$gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1628
+									$gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1629
+								}
1630
+								$post_cat = implode(',', $gd_cats);
1631
+								$gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1632
+								?>
1633 1633
                                 <tr>
1634 1634
                                     <td valign="top" width="5%"><?php echo $count; ?></td>
1635 1635
                                     <td valign="top" width="25%" id="td_post_types"><input type="checkbox"
@@ -1650,19 +1650,19 @@  discard block
 block discarded – undo
1650 1650
                     </td>
1651 1651
                 </tr>
1652 1652
                 <?php
1653
-                break;
1653
+				break;
1654 1654
 
1655
-            case 'checkbox' :
1655
+			case 'checkbox' :
1656 1656
 
1657
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1658
-                    ?>
1657
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1658
+					?>
1659 1659
                     <tr valign="top">
1660 1660
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1661 1661
                     <td class="forminp">
1662 1662
                 <?php
1663
-                endif;
1663
+				endif;
1664 1664
 
1665
-                ?>
1665
+				?>
1666 1666
                 <fieldset>
1667 1667
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1668 1668
                     <label for="<?php echo $value['id'] ?>">
@@ -1672,49 +1672,49 @@  discard block
 block discarded – undo
1672 1672
                 </fieldset>
1673 1673
                 <?php
1674 1674
 
1675
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1676
-                    ?>
1675
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1676
+					?>
1677 1677
                     </td>
1678 1678
                     </tr>
1679 1679
                 <?php
1680
-                endif;
1680
+				endif;
1681 1681
 
1682
-                break;
1682
+				break;
1683 1683
 
1684
-            case 'radio' :
1684
+			case 'radio' :
1685 1685
 
1686
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1687
-                    ?>
1686
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1687
+					?>
1688 1688
                     <tr valign="top">
1689 1689
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1690 1690
                     <td class="forminp">
1691 1691
                 <?php
1692
-                endif;
1692
+				endif;
1693 1693
 
1694
-                ?>
1694
+				?>
1695 1695
                 <fieldset>
1696 1696
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1697 1697
                     <label for="<?php echo $value['id'];?>">
1698 1698
                         <input name="<?php echo esc_attr($value['id']); ?>"
1699 1699
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1700 1700
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1701
-                            echo 'checked="checked"';
1702
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1701
+							echo 'checked="checked"';
1702
+						}elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1703 1703
                         <?php echo $value['desc']; ?></label><br>
1704 1704
                 </fieldset>
1705 1705
                 <?php
1706 1706
 
1707
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1708
-                    ?>
1707
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1708
+					?>
1709 1709
                     </td>
1710 1710
                     </tr>
1711 1711
                 <?php
1712
-                endif;
1712
+				endif;
1713 1713
 
1714
-                break;
1714
+				break;
1715 1715
 
1716
-            case 'textarea':
1717
-                ?>
1716
+			case 'textarea':
1717
+				?>
1718 1718
                 <tr valign="top">
1719 1719
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1720 1720
                 <td class="forminp">
@@ -1727,32 +1727,32 @@  discard block
 block discarded – undo
1727 1727
 
1728 1728
                 </td>
1729 1729
                 </tr><?php
1730
-                break;
1730
+				break;
1731 1731
 
1732
-            case 'editor':
1733
-                ?>
1732
+			case 'editor':
1733
+				?>
1734 1734
                 <tr valign="top">
1735 1735
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1736 1736
                 <td class="forminp"><?php
1737 1737
 
1738
-                    $content = '';
1739
-                    if (get_option($value['id']))
1740
-                        $content = stripslashes(get_option($value['id']));
1741
-                    else
1742
-                        $content = $value['std'];
1738
+					$content = '';
1739
+					if (get_option($value['id']))
1740
+						$content = stripslashes(get_option($value['id']));
1741
+					else
1742
+						$content = $value['std'];
1743 1743
 
1744
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1744
+					$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1745 1745
 
1746
-                    wp_editor($content, esc_attr($value['id']), $editor_settings);
1746
+					wp_editor($content, esc_attr($value['id']), $editor_settings);
1747 1747
 
1748
-                    ?> <span class="description"><?php echo $value['desc'] ?></span>
1748
+					?> <span class="description"><?php echo $value['desc'] ?></span>
1749 1749
 
1750 1750
                 </td>
1751 1751
                 </tr><?php
1752
-                break;
1752
+				break;
1753 1753
 
1754
-            case 'single_select_page' :
1755
-                // WPML
1754
+			case 'single_select_page' :
1755
+				// WPML
1756 1756
 				$switch_lang = false;
1757 1757
 				$disabled = '';
1758 1758
 				if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
@@ -1770,18 +1770,18 @@  discard block
 block discarded – undo
1770 1770
 				//
1771 1771
 				$page_setting = (int)get_option($value['id']);
1772 1772
 
1773
-                $args = array('name' => $value['id'],
1774
-                    'id' => $value['id'],
1775
-                    'sort_column' => 'menu_order',
1776
-                    'sort_order' => 'ASC',
1777
-                    'show_option_none' => ' ',
1778
-                    'class' => $value['class'],
1779
-                    'echo' => false,
1780
-                    'selected' => $page_setting);
1773
+				$args = array('name' => $value['id'],
1774
+					'id' => $value['id'],
1775
+					'sort_column' => 'menu_order',
1776
+					'sort_order' => 'ASC',
1777
+					'show_option_none' => ' ',
1778
+					'class' => $value['class'],
1779
+					'echo' => false,
1780
+					'selected' => $page_setting);
1781 1781
 
1782
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1782
+				if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1783 1783
 
1784
-                ?>
1784
+				?>
1785 1785
                 <tr valign="top" class="single_select_page">
1786 1786
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1787 1787
                 <td class="forminp">
@@ -1792,18 +1792,18 @@  discard block
 block discarded – undo
1792 1792
 				if ($switch_lang) {
1793 1793
 					$sitepress->switch_lang($switch_lang, true);
1794 1794
 				}
1795
-                break;
1796
-            case 'single_select_country' :
1797
-                $countries = $geodirectory->countries->countries;
1798
-                $country_setting = (string)get_option($value['id']);
1799
-                if (strstr($country_setting, ':')) :
1800
-                    $country = current(explode(':', $country_setting));
1801
-                    $state = end(explode(':', $country_setting));
1802
-                else :
1803
-                    $country = $country_setting;
1804
-                    $state = '*';
1805
-                endif;
1806
-                ?>
1795
+				break;
1796
+			case 'single_select_country' :
1797
+				$countries = $geodirectory->countries->countries;
1798
+				$country_setting = (string)get_option($value['id']);
1799
+				if (strstr($country_setting, ':')) :
1800
+					$country = current(explode(':', $country_setting));
1801
+					$state = end(explode(':', $country_setting));
1802
+				else :
1803
+					$country = $country_setting;
1804
+					$state = '*';
1805
+				endif;
1806
+				?>
1807 1807
                 <tr valign="top">
1808 1808
                 <th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th>
1809 1809
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1814,12 +1814,12 @@  discard block
 block discarded – undo
1814 1814
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1815 1815
                 </td>
1816 1816
                 </tr><?php
1817
-                break;
1818
-            case 'multi_select_countries' :
1819
-                $countries = $geodirectory->countries->countries;
1820
-                asort($countries);
1821
-                $selections = (array)get_option($value['id']);
1822
-                ?>
1817
+				break;
1818
+			case 'multi_select_countries' :
1819
+				$countries = $geodirectory->countries->countries;
1820
+				asort($countries);
1821
+				$selections = (array)get_option($value['id']);
1822
+				?>
1823 1823
                 <tr valign="top">
1824 1824
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1825 1825
                 <td class="forminp">
@@ -1827,22 +1827,22 @@  discard block
 block discarded – undo
1827 1827
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
1828 1828
                             title="Country" class="chosen_select">
1829 1829
                         <?php
1830
-                        if ($countries) foreach ($countries as $key => $val) :
1831
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1832
-                        endforeach;
1833
-                        ?>
1830
+						if ($countries) foreach ($countries as $key => $val) :
1831
+							echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1832
+						endforeach;
1833
+						?>
1834 1834
                     </select>
1835 1835
                 </td>
1836 1836
                 </tr>
1837 1837
 
1838 1838
                 <?php
1839 1839
 
1840
-                break;
1840
+				break;
1841 1841
 
1842
-            case 'google_analytics' :
1843
-                $selections = (array)get_option($value['id']);
1844
-                if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1845
-                    ?>
1842
+			case 'google_analytics' :
1843
+				$selections = (array)get_option($value['id']);
1844
+				if(get_option('geodir_ga_client_id') && get_option('geodir_ga_client_secret') ) {
1845
+					?>
1846 1846
                     <tr valign="top">
1847 1847
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1848 1848
                         <td class="forminp">
@@ -1850,19 +1850,19 @@  discard block
 block discarded – undo
1850 1850
 
1851 1851
                             <?php
1852 1852
 
1853
-                            $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1854
-                            $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1855
-                            $state = "&state=123";//any string
1856
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1857
-                            $response_type = "&response_type=code";
1858
-                            $client_id = "&client_id=".get_option('geodir_ga_client_id');
1859
-                            $access_type = "&access_type=offline";
1860
-                            $approval_prompt = "&approval_prompt=force";
1853
+							$oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1854
+							$scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1855
+							$state = "&state=123";//any string
1856
+							$redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1857
+							$response_type = "&response_type=code";
1858
+							$client_id = "&client_id=".get_option('geodir_ga_client_id');
1859
+							$access_type = "&access_type=offline";
1860
+							$approval_prompt = "&approval_prompt=force";
1861 1861
 
1862
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1862
+							$auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1863 1863
 
1864 1864
 
1865
-                            ?>
1865
+							?>
1866 1866
                             <script>
1867 1867
                                 function gd_ga_popup() {
1868 1868
                                     var win = window.open("<?php echo $auth_url;?>", "Google Analytics", "");
@@ -1877,47 +1877,47 @@  discard block
 block discarded – undo
1877 1877
                             </script>
1878 1878
 
1879 1879
                             <?php
1880
-                            if (get_option('gd_ga_refresh_token')) {
1881
-                                ?>
1880
+							if (get_option('gd_ga_refresh_token')) {
1881
+								?>
1882 1882
                                 <span class="button-primary"
1883 1883
                                       onclick="gd_ga_popup();"><?php _e('Re-authorize', 'geodirectory'); ?></span>
1884 1884
                                 <span
1885 1885
                                     style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
1886 1886
                             <?php
1887
-                            } else {
1888
-                                ?>
1887
+							} else {
1888
+								?>
1889 1889
                                 <span class="button-primary"
1890 1890
                                       onclick="gd_ga_popup();"><?php _e('Authorize', 'geodirectory');?></span>
1891 1891
                             <?php
1892
-                            }
1893
-                            ?>
1892
+							}
1893
+							?>
1894 1894
                         </td>
1895 1895
                     </tr>
1896 1896
 
1897 1897
                 <?php
1898
-                }
1898
+				}
1899 1899
 
1900
-                break;
1900
+				break;
1901 1901
 
1902
-            case 'field_seperator' :
1902
+			case 'field_seperator' :
1903 1903
 
1904
-                ?>
1904
+				?>
1905 1905
                 <tr valign="top">
1906 1906
                     <td colspan="2" class="forminp geodir_line_seperator"></td>
1907 1907
                 </tr>
1908 1908
                 <?php
1909 1909
 
1910
-                break;
1910
+				break;
1911 1911
 
1912
-        endswitch;
1912
+		endswitch;
1913 1913
 
1914
-    endforeach;
1914
+	endforeach;
1915 1915
 
1916
-    if ($first_title === false) {
1917
-        echo "</div>";
1918
-    }
1916
+	if ($first_title === false) {
1917
+		echo "</div>";
1918
+	}
1919 1919
 
1920
-    ?>
1920
+	?>
1921 1921
 
1922 1922
     <script type="text/javascript">
1923 1923
 
@@ -1977,33 +1977,33 @@  discard block
 block discarded – undo
1977 1977
  */
1978 1978
 function geodir_post_info_setting()
1979 1979
 {
1980
-    global $post, $post_id;
1981
-
1982
-    $post_type = get_post_type();
1983
-
1984
-    $package_info = array();
1985
-
1986
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
1987
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1988
-    echo '<div id="geodir_wrapper">';
1989
-    /**
1990
-     * Called before the GD custom fields are output in the wp-admin area.
1991
-     *
1992
-     * @since 1.0.0
1993
-     * @see 'geodir_after_default_field_in_meta_box'
1994
-     */
1995
-    do_action('geodir_before_default_field_in_meta_box');
1996
-    //geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
1997
-    // to display all fields in one information box
1998
-    geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
1999
-    /**
2000
-     * Called after the GD custom fields are output in the wp-admin area.
2001
-     *
2002
-     * @since 1.0.0
2003
-     * @see 'geodir_before_default_field_in_meta_box'
2004
-     */
2005
-    do_action('geodir_after_default_field_in_meta_box');
2006
-    echo '</div>';
1980
+	global $post, $post_id;
1981
+
1982
+	$post_type = get_post_type();
1983
+
1984
+	$package_info = array();
1985
+
1986
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
1987
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1988
+	echo '<div id="geodir_wrapper">';
1989
+	/**
1990
+	 * Called before the GD custom fields are output in the wp-admin area.
1991
+	 *
1992
+	 * @since 1.0.0
1993
+	 * @see 'geodir_after_default_field_in_meta_box'
1994
+	 */
1995
+	do_action('geodir_before_default_field_in_meta_box');
1996
+	//geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
1997
+	// to display all fields in one information box
1998
+	geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
1999
+	/**
2000
+	 * Called after the GD custom fields are output in the wp-admin area.
2001
+	 *
2002
+	 * @since 1.0.0
2003
+	 * @see 'geodir_before_default_field_in_meta_box'
2004
+	 */
2005
+	do_action('geodir_after_default_field_in_meta_box');
2006
+	echo '</div>';
2007 2007
 }
2008 2008
 
2009 2009
 /**
@@ -2016,18 +2016,18 @@  discard block
 block discarded – undo
2016 2016
  */
2017 2017
 function geodir_post_addinfo_setting()
2018 2018
 {
2019
-    global $post, $post_id;
2019
+	global $post, $post_id;
2020 2020
 
2021
-    $post_type = get_post_type();
2021
+	$post_type = get_post_type();
2022 2022
 
2023
-    $package_info = array();
2023
+	$package_info = array();
2024 2024
 
2025
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
2025
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
2026 2026
 
2027
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
2028
-    echo '<div id="geodir_wrapper">';
2029
-    geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
2030
-    echo '</div>';
2027
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
2028
+	echo '<div id="geodir_wrapper">';
2029
+	geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
2030
+	echo '</div>';
2031 2031
 
2032 2032
 }
2033 2033
 
@@ -2041,60 +2041,60 @@  discard block
 block discarded – undo
2041 2041
  */
2042 2042
 function geodir_post_attachments()
2043 2043
 {
2044
-    global $post, $post_id;
2044
+	global $post, $post_id;
2045 2045
 
2046
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2046
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
2047 2047
 
2048
-    if (geodir_get_featured_image($post_id, 'thumbnail')) {
2049
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2050
-        geodir_show_featured_image($post_id, 'thumbnail');
2051
-    }
2048
+	if (geodir_get_featured_image($post_id, 'thumbnail')) {
2049
+		echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
2050
+		geodir_show_featured_image($post_id, 'thumbnail');
2051
+	}
2052 2052
 
2053
-    $image_limit = 0;
2053
+	$image_limit = 0;
2054 2054
 
2055
-    ?>
2055
+	?>
2056 2056
 
2057 2057
 
2058 2058
     <h5 class="form_title">
2059 2059
         <?php if ($image_limit != 0 && $image_limit == 1) {
2060
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2061
-        } ?>
2060
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2061
+		} ?>
2062 2062
         <?php if ($image_limit != 0 && $image_limit > 1) {
2063
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2064
-        } ?>
2063
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2064
+		} ?>
2065 2065
         <?php if ($image_limit == 0) {
2066
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2067
-        } ?>
2066
+			echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2067
+		} ?>
2068 2068
     </h5>
2069 2069
 
2070 2070
 
2071 2071
     <?php
2072 2072
 
2073
-    $curImages = geodir_get_images($post_id);
2074
-    $place_img_array = array();
2073
+	$curImages = geodir_get_images($post_id);
2074
+	$place_img_array = array();
2075 2075
 
2076
-    if (!empty($curImages)):
2077
-        foreach ($curImages as $p_img):
2078
-            $place_img_array[] = $p_img->src;
2079
-        endforeach;
2080
-    endif;
2076
+	if (!empty($curImages)):
2077
+		foreach ($curImages as $p_img):
2078
+			$place_img_array[] = $p_img->src;
2079
+		endforeach;
2080
+	endif;
2081 2081
 
2082
-    if (!empty($place_img_array))
2083
-        $curImages = implode(',', $place_img_array);
2082
+	if (!empty($place_img_array))
2083
+		$curImages = implode(',', $place_img_array);
2084 2084
 
2085 2085
 
2086
-    // adjust values here
2087
-    $id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2086
+	// adjust values here
2087
+	$id = "post_images"; // this will be the name of form field. Image url(s) will be submitted in $_POST using this key. So if $id == �img1� then $_POST[�img1�] will have all the image urls
2088 2088
 
2089
-    $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2089
+	$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2090 2090
 
2091
-    $multiple = true; // allow multiple files upload
2091
+	$multiple = true; // allow multiple files upload
2092 2092
 
2093
-    $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2093
+	$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2094 2094
 
2095
-    $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2095
+	$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2096 2096
 
2097
-    ?>
2097
+	?>
2098 2098
 
2099 2099
     <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox" style="border:1px solid #999999;padding:5px;text-align:center;">
2100 2100
         <input type="hidden" name="<?php echo $id; ?>" id="<?php echo $id; ?>" value="<?php echo $svalue; ?>"/>
@@ -2136,13 +2136,13 @@  discard block
 block discarded – undo
2136 2136
  */
2137 2137
 function geodir_action_post_updated($post_ID, $post_after, $post_before)
2138 2138
 {
2139
-    $post_type = get_post_type($post_ID);
2139
+	$post_type = get_post_type($post_ID);
2140 2140
 
2141
-    if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
2142
-        if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
2143
-            geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
2144
-        }
2145
-    }
2141
+	if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
2142
+		if ($post_type != '' && in_array($post_type, geodir_get_posttypes()) && !wp_is_post_revision($post_ID) && !empty($post_after->post_title) && $post_after->post_title != $post_before->post_title) {
2143
+			geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
2144
+		}
2145
+	}
2146 2146
 }
2147 2147
 
2148 2148
 /**
@@ -2157,39 +2157,39 @@  discard block
 block discarded – undo
2157 2157
  */
2158 2158
 function geodir_notification_add_bcc_option($settings)
2159 2159
 {
2160
-    if (!empty($settings)) {
2161
-        $new_settings = array();
2162
-        foreach ($settings as $setting) {
2163
-            if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
2164
-                $geodir_bcc_listing_published_yes = array(
2165
-                    'name' => __('Listing published', 'geodirectory'),
2166
-                    'desc' => __('Yes', 'geodirectory'),
2167
-                    'id' => 'geodir_bcc_listing_published',
2168
-                    'std' => 'yes',
2169
-                    'type' => 'radio',
2170
-                    'value' => '1',
2171
-                    'radiogroup' => 'start'
2172
-                );
2173
-
2174
-                $geodir_bcc_listing_published_no = array(
2175
-                    'name' => __('Listing published', 'geodirectory'),
2176
-                    'desc' => __('No', 'geodirectory'),
2177
-                    'id' => 'geodir_bcc_listing_published',
2178
-                    'std' => 'yes',
2179
-                    'type' => 'radio',
2180
-                    'value' => '0',
2181
-                    'radiogroup' => 'end'
2182
-                );
2183
-
2184
-                $new_settings[] = $geodir_bcc_listing_published_yes;
2185
-                $new_settings[] = $geodir_bcc_listing_published_no;
2186
-            }
2187
-            $new_settings[] = $setting;
2188
-        }
2189
-        $settings = $new_settings;
2190
-    }
2160
+	if (!empty($settings)) {
2161
+		$new_settings = array();
2162
+		foreach ($settings as $setting) {
2163
+			if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
2164
+				$geodir_bcc_listing_published_yes = array(
2165
+					'name' => __('Listing published', 'geodirectory'),
2166
+					'desc' => __('Yes', 'geodirectory'),
2167
+					'id' => 'geodir_bcc_listing_published',
2168
+					'std' => 'yes',
2169
+					'type' => 'radio',
2170
+					'value' => '1',
2171
+					'radiogroup' => 'start'
2172
+				);
2173
+
2174
+				$geodir_bcc_listing_published_no = array(
2175
+					'name' => __('Listing published', 'geodirectory'),
2176
+					'desc' => __('No', 'geodirectory'),
2177
+					'id' => 'geodir_bcc_listing_published',
2178
+					'std' => 'yes',
2179
+					'type' => 'radio',
2180
+					'value' => '0',
2181
+					'radiogroup' => 'end'
2182
+				);
2183
+
2184
+				$new_settings[] = $geodir_bcc_listing_published_yes;
2185
+				$new_settings[] = $geodir_bcc_listing_published_no;
2186
+			}
2187
+			$new_settings[] = $setting;
2188
+		}
2189
+		$settings = $new_settings;
2190
+	}
2191 2191
 
2192
-    return $settings;
2192
+	return $settings;
2193 2193
 }
2194 2194
 
2195 2195
 
@@ -2204,19 +2204,19 @@  discard block
 block discarded – undo
2204 2204
  */
2205 2205
 function get_gd_theme_compat_callback()
2206 2206
 {
2207
-    global $wpdb;
2208
-    $themes = get_option('gd_theme_compats');
2209
-
2210
-    if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
2211
-        if (isset($_POST['export'])) {
2212
-            echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
2213
-        } else {
2214
-            echo json_encode($themes[$_POST['theme']]);
2215
-        }
2207
+	global $wpdb;
2208
+	$themes = get_option('gd_theme_compats');
2216 2209
 
2217
-    }
2210
+	if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
2211
+		if (isset($_POST['export'])) {
2212
+			echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
2213
+		} else {
2214
+			echo json_encode($themes[$_POST['theme']]);
2215
+		}
2216
+
2217
+	}
2218 2218
 
2219
-    die();
2219
+	die();
2220 2220
 }
2221 2221
 
2222 2222
 add_action('wp_ajax_get_gd_theme_compat_import_callback', 'get_gd_theme_compat_import_callback');
@@ -2230,20 +2230,20 @@  discard block
 block discarded – undo
2230 2230
  */
2231 2231
 function get_gd_theme_compat_import_callback()
2232 2232
 {
2233
-    global $wpdb;
2234
-    $themes = get_option('gd_theme_compats');
2235
-    if (isset($_POST['theme']) && !empty($_POST['theme'])) {
2236
-        $json = json_decode(stripslashes($_POST['theme']), true);
2237
-        if (!empty($json) && is_array($json)) {
2238
-            $key = sanitize_text_field(key($json));
2239
-            $themes[$key] = $json[$key];
2240
-            update_option('gd_theme_compats', $themes);
2241
-            echo $key;
2242
-            die();
2243
-        }
2244
-    }
2245
-    echo '0';
2246
-    die();
2233
+	global $wpdb;
2234
+	$themes = get_option('gd_theme_compats');
2235
+	if (isset($_POST['theme']) && !empty($_POST['theme'])) {
2236
+		$json = json_decode(stripslashes($_POST['theme']), true);
2237
+		if (!empty($json) && is_array($json)) {
2238
+			$key = sanitize_text_field(key($json));
2239
+			$themes[$key] = $json[$key];
2240
+			update_option('gd_theme_compats', $themes);
2241
+			echo $key;
2242
+			die();
2243
+		}
2244
+	}
2245
+	echo '0';
2246
+	die();
2247 2247
 }
2248 2248
 
2249 2249
 
@@ -2256,39 +2256,39 @@  discard block
 block discarded – undo
2256 2256
  */
2257 2257
 function gd_set_theme_compat()
2258 2258
 {
2259
-    global $wpdb;
2260
-    $theme = wp_get_theme();
2259
+	global $wpdb;
2260
+	$theme = wp_get_theme();
2261 2261
 
2262
-    if ($theme->parent()) {
2263
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
2264
-    } else {
2265
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
2266
-    }
2262
+	if ($theme->parent()) {
2263
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
2264
+	} else {
2265
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
2266
+	}
2267 2267
 
2268
-    $theme_compats = get_option('gd_theme_compats');
2269
-    $current_compat = get_option('gd_theme_compat');
2270
-    $current_compat = str_replace("_custom", "", $current_compat);
2268
+	$theme_compats = get_option('gd_theme_compats');
2269
+	$current_compat = get_option('gd_theme_compat');
2270
+	$current_compat = str_replace("_custom", "", $current_compat);
2271 2271
 
2272
-    if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
2273
-        return;
2274
-    }// if already running corect compat then bail
2272
+	if ($current_compat == $theme_name && strpos("_custom", get_option('gd_theme_compat')) !== false) {
2273
+		return;
2274
+	}// if already running corect compat then bail
2275 2275
 
2276
-    if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
2277
-        update_option('gd_theme_compat', $theme_name);
2278
-        update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
2276
+	if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
2277
+		update_option('gd_theme_compat', $theme_name);
2278
+		update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
2279 2279
 
2280
-        // if there are default options to set then set them
2281
-        if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
2280
+		// if there are default options to set then set them
2281
+		if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
2282 2282
 
2283
-            foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
2284
-                update_option($key, $val);
2285
-            }
2286
-        }
2283
+			foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
2284
+				update_option($key, $val);
2285
+			}
2286
+		}
2287 2287
 
2288
-    } else {
2289
-        update_option('gd_theme_compat', '');
2290
-        update_option('theme_compatibility_setting', '');
2291
-    }
2288
+	} else {
2289
+		update_option('gd_theme_compat', '');
2290
+		update_option('theme_compatibility_setting', '');
2291
+	}
2292 2292
 
2293 2293
 
2294 2294
 }
@@ -2303,9 +2303,9 @@  discard block
 block discarded – undo
2303 2303
  */
2304 2304
 function gd_check_avada_compat()
2305 2305
 {
2306
-    if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2307
-        add_action('admin_notices', 'gd_avada_compat_warning');
2308
-    }
2306
+	if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2307
+		add_action('admin_notices', 'gd_avada_compat_warning');
2308
+	}
2309 2309
 }
2310 2310
 
2311 2311
 
@@ -2318,22 +2318,22 @@  discard block
 block discarded – undo
2318 2318
 function gd_avada_compat_warning()
2319 2319
 {
2320 2320
 
2321
-    /*
2321
+	/*
2322 2322
     $msg_type = error
2323 2323
     $msg_type = updated fade
2324 2324
     $msg_type = update-nag
2325 2325
     */
2326 2326
 
2327
-    $plugin = 'avada-nag';
2328
-    $timestamp = 'avada-nag1234';
2329
-    $message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
2330
-    echo '<div id="' . $timestamp . '"  class="error">';
2331
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2332
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2333
-    echo "<p>$message</p>";
2334
-    echo "</div>";
2327
+	$plugin = 'avada-nag';
2328
+	$timestamp = 'avada-nag1234';
2329
+	$message = __('Welcome to GeoDirectory, please have a look <a href="https://docs.wpgeodirectory.com/category/getting-started/" target="_blank">here</a> to get started. :)', 'geodirectory');
2330
+	echo '<div id="' . $timestamp . '"  class="error">';
2331
+	echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2332
+	echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2333
+	echo "<p>$message</p>";
2334
+	echo "</div>";
2335 2335
 
2336
-    ?>
2336
+	?>
2337 2337
     <script>
2338 2338
         function gdRemoveANotification($plugin, $timestamp) {
2339 2339
 
@@ -2401,10 +2401,10 @@  discard block
 block discarded – undo
2401 2401
  */
2402 2402
 function geodir_avada_remove_notification()
2403 2403
 {
2404
-    update_option('avada_nag', TRUE);
2404
+	update_option('avada_nag', TRUE);
2405 2405
 
2406
-    // Always die in functions echoing ajax content
2407
-    die();
2406
+	// Always die in functions echoing ajax content
2407
+	die();
2408 2408
 }
2409 2409
 
2410 2410
 
@@ -2463,7 +2463,7 @@  discard block
 block discarded – undo
2463 2463
 		// Don't allow same slug url for listing and location
2464 2464
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2465 2465
 			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2466
-        	wp_redirect($redirect_url);
2466
+			wp_redirect($redirect_url);
2467 2467
 			exit;
2468 2468
 		}
2469 2469
 		
@@ -2493,10 +2493,10 @@  discard block
 block discarded – undo
2493 2493
  * @package GeoDirectory
2494 2494
  */
2495 2495
 function geodir_hide_admin_preview_button() {
2496
-    global $post_type;
2497
-    $post_types = geodir_get_posttypes();
2498
-    if(in_array($post_type, $post_types))
2499
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2496
+	global $post_type;
2497
+	$post_types = geodir_get_posttypes();
2498
+	if(in_array($post_type, $post_types))
2499
+		echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2500 2500
 }
2501 2501
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2502 2502
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
@@ -2511,7 +2511,7 @@  discard block
 block discarded – undo
2511 2511
  */
2512 2512
 function geodir_import_export_tab( $tabs ) {
2513 2513
 	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2514
-    return $tabs;
2514
+	return $tabs;
2515 2515
 }
2516 2516
 
2517 2517
 /**
@@ -2526,26 +2526,26 @@  discard block
 block discarded – undo
2526 2526
 function geodir_import_export_page() {
2527 2527
 	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2528 2528
 	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2529
-    /**
2530
-     * Filter sample category data csv file url.
2531
-     *
2532
-     * @since 1.0.0
2533
-     * @package GeoDirectory
2534
-     *
2535
-     * @param string $gd_cats_sample_csv Sample category data csv file url.
2536
-     */
2529
+	/**
2530
+	 * Filter sample category data csv file url.
2531
+	 *
2532
+	 * @since 1.0.0
2533
+	 * @package GeoDirectory
2534
+	 *
2535
+	 * @param string $gd_cats_sample_csv Sample category data csv file url.
2536
+	 */
2537 2537
 	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2538 2538
 	
2539 2539
 	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2540
-    /**
2541
-     * Filter sample post data csv file url.
2542
-     *
2543
-     * @since 1.0.0
2544
-     * @package GeoDirectory
2545
-     *
2546
-     * @param string $gd_posts_sample_csv Sample post data csv file url.
2547
-     */
2548
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2540
+	/**
2541
+	 * Filter sample post data csv file url.
2542
+	 *
2543
+	 * @since 1.0.0
2544
+	 * @package GeoDirectory
2545
+	 *
2546
+	 * @param string $gd_posts_sample_csv Sample post data csv file url.
2547
+	 */
2548
+	$gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2549 2549
 	
2550 2550
 	$gd_posttypes = geodir_get_posttypes( 'array' );
2551 2551
 	
@@ -2568,14 +2568,14 @@  discard block
 block discarded – undo
2568 2568
 	$gd_chunksize_options[100000] = 100000;
2569 2569
 	 
2570 2570
 	 /**
2571
-     * Filter max entries per export csv file.
2572
-     *
2573
-     * @since 1.5.6
2574
-     * @package GeoDirectory
2575
-     *
2576
-     * @param string $gd_chunksize_options Entries options.
2577
-     */
2578
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2571
+	  * Filter max entries per export csv file.
2572
+	  *
2573
+	  * @since 1.5.6
2574
+	  * @package GeoDirectory
2575
+	  *
2576
+	  * @param string $gd_chunksize_options Entries options.
2577
+	  */
2578
+	$gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2579 2579
 	
2580 2580
 	$gd_chunksize_option = '';
2581 2581
 	foreach ($gd_chunksize_options as $value => $title) {
@@ -2591,12 +2591,12 @@  discard block
 block discarded – undo
2591 2591
   <div class="gd-content-heading">
2592 2592
 
2593 2593
   <?php
2594
-    ini_set('max_execution_time', 999999);
2595
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2596
-    ini_restore('max_execution_time');
2594
+	ini_set('max_execution_time', 999999);
2595
+	$ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2596
+	ini_restore('max_execution_time');
2597 2597
 
2598
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2599
-        ?>
2598
+	if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2599
+		?>
2600 2600
 	<div id="gd_ie_reqs" class="metabox-holder">
2601 2601
       <div class="meta-box-sortables ui-sortable">
2602 2602
         <div class="postbox">
@@ -2765,7 +2765,7 @@  discard block
 block discarded – undo
2765 2765
 						 * Called just after the sample CSV download link.
2766 2766
 						 *
2767 2767
 						 * @since 1.0.0
2768
-                         * @package GeoDirectory
2768
+						 * @package GeoDirectory
2769 2769
 						 */
2770 2770
 						do_action('geodir_sample_cats_csv_download_link');
2771 2771
 						?>
@@ -2850,11 +2850,11 @@  discard block
 block discarded – undo
2850 2850
 	 *
2851 2851
 	 * Called after the last setting on the GD > Import & Export page.
2852 2852
 	 * @since 1.4.6
2853
-     * @package GeoDirectory
2853
+	 * @package GeoDirectory
2854 2854
 	 *
2855 2855
 	 * @param array $gd_posttypes GD post types.
2856
-     * @param array $gd_chunksize_options File chunk size options.
2857
-     * @param string $nonce Wordpress security token for GD import & export.
2856
+	 * @param array $gd_chunksize_options File chunk size options.
2857
+	 * @param string $nonce Wordpress security token for GD import & export.
2858 2858
 	 */
2859 2859
 	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2860 2860
 	?>
@@ -3519,44 +3519,44 @@  discard block
 block discarded – undo
3519 3519
 function geodir_init_filesystem()
3520 3520
 {
3521 3521
 
3522
-    if(!function_exists('get_filesystem_method')){
3523
-        require_once(ABSPATH."/wp-admin/includes/file.php");
3524
-    }
3525
-    $access_type = get_filesystem_method();
3526
-    if ($access_type === 'direct') {
3527
-        /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3528
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3529
-
3530
-        /* initialize the API */
3531
-        if (!WP_Filesystem($creds)) {
3532
-            /* any problems and we exit */
3533
-            //return '@@@3';
3534
-            return false;
3535
-        }
3536
-
3537
-        global $wp_filesystem;
3538
-        return $wp_filesystem;
3539
-        /* do our file manipulations below */
3540
-    } elseif (defined('FTP_USER')) {
3541
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3522
+	if(!function_exists('get_filesystem_method')){
3523
+		require_once(ABSPATH."/wp-admin/includes/file.php");
3524
+	}
3525
+	$access_type = get_filesystem_method();
3526
+	if ($access_type === 'direct') {
3527
+		/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3528
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3529
+
3530
+		/* initialize the API */
3531
+		if (!WP_Filesystem($creds)) {
3532
+			/* any problems and we exit */
3533
+			//return '@@@3';
3534
+			return false;
3535
+		}
3542 3536
 
3543
-        /* initialize the API */
3544
-        if (!WP_Filesystem($creds)) {
3545
-            /* any problems and we exit */
3546
-            //return '@@@33';
3547
-            return false;
3548
-        }
3537
+		global $wp_filesystem;
3538
+		return $wp_filesystem;
3539
+		/* do our file manipulations below */
3540
+	} elseif (defined('FTP_USER')) {
3541
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3542
+
3543
+		/* initialize the API */
3544
+		if (!WP_Filesystem($creds)) {
3545
+			/* any problems and we exit */
3546
+			//return '@@@33';
3547
+			return false;
3548
+		}
3549 3549
 
3550
-        global $wp_filesystem;
3551
-        //return '@@@1';
3552
-        return $wp_filesystem;
3550
+		global $wp_filesystem;
3551
+		//return '@@@1';
3552
+		return $wp_filesystem;
3553 3553
 
3554
-    } else {
3555
-        //return '@@@2';
3556
-        /* don't have direct write access. Prompt user with our notice */
3557
-        add_action('admin_notice', 'geodir_filesystem_notice');
3558
-        return false;
3559
-    }
3554
+	} else {
3555
+		//return '@@@2';
3556
+		/* don't have direct write access. Prompt user with our notice */
3557
+		add_action('admin_notice', 'geodir_filesystem_notice');
3558
+		return false;
3559
+	}
3560 3560
 
3561 3561
 }
3562 3562
 
@@ -3574,10 +3574,10 @@  discard block
 block discarded – undo
3574 3574
  */
3575 3575
 function geodir_filesystem_notice()
3576 3576
 {   if ( defined( 'DOING_AJAX' ) ){return;}
3577
-    $access_type = get_filesystem_method();
3578
-    if ($access_type === 'direct') {
3579
-    } elseif (!defined('FTP_USER')) {
3580
-        ?>
3577
+	$access_type = get_filesystem_method();
3578
+	if ($access_type === 'direct') {
3579
+	} elseif (!defined('FTP_USER')) {
3580
+		?>
3581 3581
         <div class="error">
3582 3582
             <p><?php _e('GeoDirectory does not have access to your filesystem, thing like import/export will not work. Please define your details in wp-config.php as explained here', 'geodirectory'); ?>
3583 3583
                 <a target="_blank" href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants</a>
@@ -3603,1448 +3603,1448 @@  discard block
 block discarded – undo
3603 3603
  * @return string Json data.
3604 3604
  */
3605 3605
 function geodir_ajax_import_export() {
3606
-    global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3606
+	global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3607 3607
     
3608
-    error_reporting(0);
3608
+	error_reporting(0);
3609 3609
 
3610
-    // try to set higher limits for import
3611
-    $max_input_time = ini_get('max_input_time');
3612
-    $max_execution_time = ini_get('max_execution_time');
3613
-    $memory_limit= ini_get('memory_limit');
3610
+	// try to set higher limits for import
3611
+	$max_input_time = ini_get('max_input_time');
3612
+	$max_execution_time = ini_get('max_execution_time');
3613
+	$memory_limit= ini_get('memory_limit');
3614 3614
 
3615
-    if(!$max_input_time || $max_input_time<3000){
3616
-        ini_set('max_input_time', 3000);
3617
-    }
3615
+	if(!$max_input_time || $max_input_time<3000){
3616
+		ini_set('max_input_time', 3000);
3617
+	}
3618 3618
 
3619
-    if(!$max_execution_time || $max_execution_time<3000){
3620
-        ini_set('max_execution_time', 3000);
3621
-    }
3619
+	if(!$max_execution_time || $max_execution_time<3000){
3620
+		ini_set('max_execution_time', 3000);
3621
+	}
3622 3622
 
3623
-    if($memory_limit && str_replace('M','',$memory_limit)){
3624
-        if(str_replace('M','',$memory_limit)<256){
3625
-            ini_set('memory_limit', '256M');
3626
-        }
3627
-    }
3623
+	if($memory_limit && str_replace('M','',$memory_limit)){
3624
+		if(str_replace('M','',$memory_limit)<256){
3625
+			ini_set('memory_limit', '256M');
3626
+		}
3627
+	}
3628 3628
 
3629
-    $json = array();
3629
+	$json = array();
3630 3630
 
3631
-    if ( !current_user_can( 'manage_options' ) ) {
3632
-        wp_send_json( $json );
3633
-    }
3631
+	if ( !current_user_can( 'manage_options' ) ) {
3632
+		wp_send_json( $json );
3633
+	}
3634 3634
 
3635
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3636
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3637
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3635
+	$task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3636
+	$nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3637
+	$stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3638 3638
 
3639
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3640
-        wp_send_json( $json );
3641
-    }
3639
+	if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3640
+		wp_send_json( $json );
3641
+	}
3642 3642
 
3643
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3644
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3645
-    $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3646
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3643
+	$post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3644
+	$chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3645
+	$chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3646
+	$chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3647 3647
 
3648
-    $wp_filesystem = geodir_init_filesystem();
3649
-    if (!$wp_filesystem) {
3650
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3651
-        wp_send_json( $json );
3652
-    }
3648
+	$wp_filesystem = geodir_init_filesystem();
3649
+	if (!$wp_filesystem) {
3650
+		$json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3651
+		wp_send_json( $json );
3652
+	}
3653 3653
 
3654
-    if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3655
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3656
-        wp_send_json( $json );
3657
-    }
3654
+	if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3655
+		$json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3656
+		wp_send_json( $json );
3657
+	}
3658 3658
 
3659
-    $csv_file_dir = geodir_path_import_export( false );
3660
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3661
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3662
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3663
-            wp_send_json( $json );
3664
-        }
3665
-    }
3659
+	$csv_file_dir = geodir_path_import_export( false );
3660
+	if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3661
+		if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3662
+			$json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3663
+			wp_send_json( $json );
3664
+		}
3665
+	}
3666 3666
     
3667
-    $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3668
-    $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3669
-
3670
-    switch ( $task ) {
3671
-        case 'export_posts': {
3672
-            // WPML
3673
-            $is_wpml = geodir_is_wpml();
3674
-            if ($is_wpml) {
3675
-                global $sitepress;
3676
-                $active_lang = ICL_LANGUAGE_CODE;
3667
+	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3668
+	$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3669
+
3670
+	switch ( $task ) {
3671
+		case 'export_posts': {
3672
+			// WPML
3673
+			$is_wpml = geodir_is_wpml();
3674
+			if ($is_wpml) {
3675
+				global $sitepress;
3676
+				$active_lang = ICL_LANGUAGE_CODE;
3677 3677
                 
3678
-                $sitepress->switch_lang('all', true);
3679
-            }
3680
-            // WPML
3681
-            if ( $post_type == 'gd_event' ) {
3682
-                //add_filter( 'geodir_imex_count_posts', 'geodir_imex_count_events', 10, 2 );
3683
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3684
-            }
3685
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3686
-            $posts_count = geodir_get_posts_count( $post_type );
3687
-            $file_url_base = geodir_path_import_export() . '/';
3688
-            $file_url = $file_url_base . $file_name . '.csv';
3689
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3690
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3678
+				$sitepress->switch_lang('all', true);
3679
+			}
3680
+			// WPML
3681
+			if ( $post_type == 'gd_event' ) {
3682
+				//add_filter( 'geodir_imex_count_posts', 'geodir_imex_count_events', 10, 2 );
3683
+				add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3684
+			}
3685
+			$file_name = $post_type . '_' . date( 'dmyHi' );
3686
+			$posts_count = geodir_get_posts_count( $post_type );
3687
+			$file_url_base = geodir_path_import_export() . '/';
3688
+			$file_url = $file_url_base . $file_name . '.csv';
3689
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3690
+			$file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3691 3691
             
3692
-            $chunk_file_paths = array();
3692
+			$chunk_file_paths = array();
3693 3693
 
3694
-            if ( isset( $_REQUEST['_st'] ) ) {
3695
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3696
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3697
-                $percentage = min( $percentage, 100 );
3694
+			if ( isset( $_REQUEST['_st'] ) ) {
3695
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3696
+				$percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3697
+				$percentage = min( $percentage, 100 );
3698 3698
                 
3699
-                $json['percentage'] = $percentage;
3700
-                // WPML
3701
-                if ($is_wpml) {
3702
-                    $sitepress->switch_lang($active_lang, true);
3703
-                }
3704
-                // WPML
3705
-                wp_send_json( $json );
3706
-                exit;
3707
-            } else {
3708
-                if ( !$posts_count > 0 ) {
3709
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3710
-                } else {
3711
-                    $total_posts = $posts_count;
3712
-                    if ($chunk_per_page > $total_posts) {
3713
-                        $chunk_per_page = $total_posts;
3714
-                    }
3715
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3699
+				$json['percentage'] = $percentage;
3700
+				// WPML
3701
+				if ($is_wpml) {
3702
+					$sitepress->switch_lang($active_lang, true);
3703
+				}
3704
+				// WPML
3705
+				wp_send_json( $json );
3706
+				exit;
3707
+			} else {
3708
+				if ( !$posts_count > 0 ) {
3709
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3710
+				} else {
3711
+					$total_posts = $posts_count;
3712
+					if ($chunk_per_page > $total_posts) {
3713
+						$chunk_per_page = $total_posts;
3714
+					}
3715
+					$chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3716 3716
                     
3717
-                    $j = $chunk_page_no;
3718
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3717
+					$j = $chunk_page_no;
3718
+					$chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3719 3719
                     
3720
-                    $per_page = 500;
3721
-                    if ($per_page > $chunk_per_page) {
3722
-                        $per_page = $chunk_per_page;
3723
-                    }
3724
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3720
+					$per_page = 500;
3721
+					if ($per_page > $chunk_per_page) {
3722
+						$per_page = $chunk_per_page;
3723
+					}
3724
+					$total_pages = ceil( $chunk_per_page / $per_page );
3725 3725
                     
3726
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3727
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3726
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3727
+						$save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3728 3728
                         
3729
-                        $clear = $i == 0 ? true : false;
3730
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3731
-                    }
3729
+						$clear = $i == 0 ? true : false;
3730
+						geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3731
+					}
3732 3732
                         
3733
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3734
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3735
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3736
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3737
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3733
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3734
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3735
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3736
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3737
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3738 3738
                         
3739
-                        $file_url = $file_url_base . $chunk_file_name;
3740
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3741
-                    }
3739
+						$file_url = $file_url_base . $chunk_file_name;
3740
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3741
+					}
3742 3742
                     
3743
-                    if ( !empty($chunk_file_paths) ) {
3744
-                        $json['total'] = $posts_count;
3745
-                        $json['files'] = $chunk_file_paths;
3746
-                    } else {
3747
-                        if ($j > 1) {
3748
-                            $json['total'] = $items_count;
3749
-                            $json['files'] = array();
3750
-                        } else {
3751
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3752
-                        }
3753
-                    }
3754
-                }
3755
-                // WPML
3756
-                if ($is_wpml) {
3757
-                    $sitepress->switch_lang($active_lang, true);
3758
-                }
3759
-                // WPML
3760
-                wp_send_json( $json );
3761
-            }
3762
-        }
3763
-        break;
3764
-        case 'export_cats': {
3765
-            // WPML
3766
-            $is_wpml = geodir_is_wpml();
3767
-            if ($is_wpml) {
3768
-                global $sitepress;
3769
-                $active_lang = ICL_LANGUAGE_CODE;
3743
+					if ( !empty($chunk_file_paths) ) {
3744
+						$json['total'] = $posts_count;
3745
+						$json['files'] = $chunk_file_paths;
3746
+					} else {
3747
+						if ($j > 1) {
3748
+							$json['total'] = $items_count;
3749
+							$json['files'] = array();
3750
+						} else {
3751
+							$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3752
+						}
3753
+					}
3754
+				}
3755
+				// WPML
3756
+				if ($is_wpml) {
3757
+					$sitepress->switch_lang($active_lang, true);
3758
+				}
3759
+				// WPML
3760
+				wp_send_json( $json );
3761
+			}
3762
+		}
3763
+		break;
3764
+		case 'export_cats': {
3765
+			// WPML
3766
+			$is_wpml = geodir_is_wpml();
3767
+			if ($is_wpml) {
3768
+				global $sitepress;
3769
+				$active_lang = ICL_LANGUAGE_CODE;
3770 3770
                 
3771
-                $sitepress->switch_lang('all', true);
3772
-            }
3773
-            // WPML
3774
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3771
+				$sitepress->switch_lang('all', true);
3772
+			}
3773
+			// WPML
3774
+			$file_name = $post_type . 'category_' . date( 'dmyHi' );
3775 3775
             
3776
-            $terms_count = geodir_get_terms_count( $post_type );
3777
-            $file_url_base = geodir_path_import_export() . '/';
3778
-            $file_url = $file_url_base . $file_name . '.csv';
3779
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3780
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3776
+			$terms_count = geodir_get_terms_count( $post_type );
3777
+			$file_url_base = geodir_path_import_export() . '/';
3778
+			$file_url = $file_url_base . $file_name . '.csv';
3779
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3780
+			$file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3781 3781
             
3782
-            $chunk_file_paths = array();
3782
+			$chunk_file_paths = array();
3783 3783
             
3784
-            if ( isset( $_REQUEST['_st'] ) ) {
3785
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3786
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3787
-                $percentage = min( $percentage, 100 );
3784
+			if ( isset( $_REQUEST['_st'] ) ) {
3785
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3786
+				$percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3787
+				$percentage = min( $percentage, 100 );
3788 3788
                 
3789
-                $json['percentage'] = $percentage;
3790
-                // WPML
3791
-                if ($is_wpml) {
3792
-                    $sitepress->switch_lang($active_lang, true);
3793
-                }
3794
-                // WPML
3795
-                wp_send_json( $json );
3796
-            } else {
3797
-                if ( !$terms_count > 0 ) {
3798
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3799
-                } else {
3800
-                    $total_terms = $terms_count;
3801
-                    if ($chunk_per_page > $terms_count) {
3802
-                        $chunk_per_page = $terms_count;
3803
-                    }
3804
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3789
+				$json['percentage'] = $percentage;
3790
+				// WPML
3791
+				if ($is_wpml) {
3792
+					$sitepress->switch_lang($active_lang, true);
3793
+				}
3794
+				// WPML
3795
+				wp_send_json( $json );
3796
+			} else {
3797
+				if ( !$terms_count > 0 ) {
3798
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3799
+				} else {
3800
+					$total_terms = $terms_count;
3801
+					if ($chunk_per_page > $terms_count) {
3802
+						$chunk_per_page = $terms_count;
3803
+					}
3804
+					$chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3805 3805
                     
3806
-                    $j = $chunk_page_no;
3807
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3806
+					$j = $chunk_page_no;
3807
+					$chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3808 3808
                     
3809
-                    $per_page = 500;
3810
-                    if ($per_page > $chunk_per_page) {
3811
-                        $per_page = $chunk_per_page;
3812
-                    }
3813
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3809
+					$per_page = 500;
3810
+					if ($per_page > $chunk_per_page) {
3811
+						$per_page = $chunk_per_page;
3812
+					}
3813
+					$total_pages = ceil( $chunk_per_page / $per_page );
3814 3814
                     
3815
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3816
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3815
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3816
+						$save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3817 3817
                         
3818
-                        $clear = $i == 0 ? true : false;
3819
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3820
-                    }
3818
+						$clear = $i == 0 ? true : false;
3819
+						geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3820
+					}
3821 3821
                     
3822
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3823
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3824
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3825
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3826
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3822
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3823
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3824
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3825
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3826
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3827 3827
                         
3828
-                        $file_url = $file_url_base . $chunk_file_name;
3829
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3830
-                    }
3828
+						$file_url = $file_url_base . $chunk_file_name;
3829
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3830
+					}
3831 3831
                     
3832
-                    if ( !empty($chunk_file_paths) ) {
3833
-                        $json['total'] = $terms_count;
3834
-                        $json['files'] = $chunk_file_paths;
3835
-                    } else {
3836
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3837
-                    }
3838
-                }
3839
-                // WPML
3840
-                if ($is_wpml) {
3841
-                    $sitepress->switch_lang($active_lang, true);
3842
-                }
3843
-                // WPML
3844
-                wp_send_json( $json );
3845
-            }
3846
-        }
3847
-        break;
3848
-        case 'export_locations': {
3849
-            $file_url_base = geodir_path_import_export() . '/';
3850
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3851
-            $file_url = $file_url_base . $file_name . '.csv';
3852
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3853
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3832
+					if ( !empty($chunk_file_paths) ) {
3833
+						$json['total'] = $terms_count;
3834
+						$json['files'] = $chunk_file_paths;
3835
+					} else {
3836
+						$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3837
+					}
3838
+				}
3839
+				// WPML
3840
+				if ($is_wpml) {
3841
+					$sitepress->switch_lang($active_lang, true);
3842
+				}
3843
+				// WPML
3844
+				wp_send_json( $json );
3845
+			}
3846
+		}
3847
+		break;
3848
+		case 'export_locations': {
3849
+			$file_url_base = geodir_path_import_export() . '/';
3850
+			$file_name = 'gd_locations_' . date( 'dmyHi' );
3851
+			$file_url = $file_url_base . $file_name . '.csv';
3852
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3853
+			$file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3854 3854
             
3855
-            $items_count = (int)geodir_location_imex_count_locations();
3855
+			$items_count = (int)geodir_location_imex_count_locations();
3856 3856
             
3857
-            if ( isset( $_REQUEST['_st'] ) ) {
3858
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3859
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3860
-                $percentage = min( $percentage, 100 );
3857
+			if ( isset( $_REQUEST['_st'] ) ) {
3858
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3859
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3860
+				$percentage = min( $percentage, 100 );
3861 3861
                 
3862
-                $json['percentage'] = $percentage;
3863
-                wp_send_json( $json );
3864
-            } else {
3865
-                $chunk_file_paths = array();
3862
+				$json['percentage'] = $percentage;
3863
+				wp_send_json( $json );
3864
+			} else {
3865
+				$chunk_file_paths = array();
3866 3866
                 
3867
-                if ( !$items_count > 0 ) {
3868
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3869
-                } else {
3870
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3871
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3867
+				if ( !$items_count > 0 ) {
3868
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3869
+				} else {
3870
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3871
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3872 3872
                     
3873
-                    $j = $chunk_page_no;
3874
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3873
+					$j = $chunk_page_no;
3874
+					$chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3875 3875
                     
3876
-                    $per_page = 500;
3877
-                    $per_page = min( $per_page, $chunk_per_page );
3878
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3876
+					$per_page = 500;
3877
+					$per_page = min( $per_page, $chunk_per_page );
3878
+					$total_pages = ceil( $chunk_per_page / $per_page );
3879 3879
                     
3880
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3881
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3880
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3881
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3882 3882
                         
3883
-                        $clear = $i == 0 ? true : false;
3884
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3885
-                    }
3883
+						$clear = $i == 0 ? true : false;
3884
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3885
+					}
3886 3886
                     
3887
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3888
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3889
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3890
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3891
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3887
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3888
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3889
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3890
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3891
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3892 3892
                         
3893
-                        $file_url = $file_url_base . $chunk_file_name;
3894
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3895
-                    }
3893
+						$file_url = $file_url_base . $chunk_file_name;
3894
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3895
+					}
3896 3896
                     
3897
-                    if ( !empty($chunk_file_paths) ) {
3898
-                        $json['total'] = $items_count;
3899
-                        $json['files'] = $chunk_file_paths;
3900
-                    } else {
3901
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3902
-                    }
3903
-                }
3904
-                wp_send_json( $json );
3905
-            }
3906
-        }
3907
-        break;
3908
-        case 'export_hoods': {
3909
-            $file_url_base = geodir_path_import_export() . '/';
3910
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3911
-            $file_url = $file_url_base . $file_name . '.csv';
3912
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3913
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3897
+					if ( !empty($chunk_file_paths) ) {
3898
+						$json['total'] = $items_count;
3899
+						$json['files'] = $chunk_file_paths;
3900
+					} else {
3901
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3902
+					}
3903
+				}
3904
+				wp_send_json( $json );
3905
+			}
3906
+		}
3907
+		break;
3908
+		case 'export_hoods': {
3909
+			$file_url_base = geodir_path_import_export() . '/';
3910
+			$file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3911
+			$file_url = $file_url_base . $file_name . '.csv';
3912
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3913
+			$file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3914 3914
             
3915
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3915
+			$items_count = (int)geodir_location_imex_count_neighbourhoods();
3916 3916
             
3917
-            if ( isset( $_REQUEST['_st'] ) ) {
3918
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3919
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3920
-                $percentage = min( $percentage, 100 );
3917
+			if ( isset( $_REQUEST['_st'] ) ) {
3918
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3919
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3920
+				$percentage = min( $percentage, 100 );
3921 3921
                 
3922
-                $json['percentage'] = $percentage;
3923
-                wp_send_json( $json );
3924
-            } else {
3925
-                $chunk_file_paths = array();
3922
+				$json['percentage'] = $percentage;
3923
+				wp_send_json( $json );
3924
+			} else {
3925
+				$chunk_file_paths = array();
3926 3926
                 
3927
-                if ( !$items_count > 0 ) {
3928
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3929
-                } else {
3930
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3931
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3927
+				if ( !$items_count > 0 ) {
3928
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3929
+				} else {
3930
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3931
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3932 3932
                     
3933
-                    $j = $chunk_page_no;
3934
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3933
+					$j = $chunk_page_no;
3934
+					$chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3935 3935
                     
3936
-                    $per_page = 500;
3937
-                    $per_page = min( $per_page, $chunk_per_page );
3938
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3936
+					$per_page = 500;
3937
+					$per_page = min( $per_page, $chunk_per_page );
3938
+					$total_pages = ceil( $chunk_per_page / $per_page );
3939 3939
                     
3940
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3941
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3940
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3941
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3942 3942
                         
3943
-                        $clear = $i == 0 ? true : false;
3944
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3945
-                    }
3943
+						$clear = $i == 0 ? true : false;
3944
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3945
+					}
3946 3946
                     
3947
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3948
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3949
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3950
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3951
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3947
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3948
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3949
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3950
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3951
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3952 3952
                         
3953
-                        $file_url = $file_url_base . $chunk_file_name;
3954
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3955
-                    }
3953
+						$file_url = $file_url_base . $chunk_file_name;
3954
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3955
+					}
3956 3956
                     
3957
-                    if ( !empty($chunk_file_paths) ) {
3958
-                        $json['total'] = $items_count;
3959
-                        $json['files'] = $chunk_file_paths;
3960
-                    } else {
3961
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3962
-                    }
3963
-                }
3964
-                wp_send_json( $json );
3965
-            }
3966
-        }
3967
-        break;
3968
-        case 'prepare_import':
3969
-        case 'import_cat':
3970
-        case 'import_post':
3971
-        case 'import_loc':
3972
-        case 'import_hood': {
3973
-            // WPML
3974
-            $is_wpml = geodir_is_wpml();
3975
-            if ($is_wpml) {
3976
-                global $sitepress;
3977
-                $active_lang = ICL_LANGUAGE_CODE;
3978
-            }
3979
-            // WPML
3957
+					if ( !empty($chunk_file_paths) ) {
3958
+						$json['total'] = $items_count;
3959
+						$json['files'] = $chunk_file_paths;
3960
+					} else {
3961
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3962
+					}
3963
+				}
3964
+				wp_send_json( $json );
3965
+			}
3966
+		}
3967
+		break;
3968
+		case 'prepare_import':
3969
+		case 'import_cat':
3970
+		case 'import_post':
3971
+		case 'import_loc':
3972
+		case 'import_hood': {
3973
+			// WPML
3974
+			$is_wpml = geodir_is_wpml();
3975
+			if ($is_wpml) {
3976
+				global $sitepress;
3977
+				$active_lang = ICL_LANGUAGE_CODE;
3978
+			}
3979
+			// WPML
3980 3980
             
3981
-            ini_set( 'auto_detect_line_endings', true );
3981
+			ini_set( 'auto_detect_line_endings', true );
3982 3982
             
3983
-            $uploads = wp_upload_dir();
3984
-            $uploads_dir = $uploads['path'];
3985
-            $uploads_subdir = $uploads['subdir'];
3983
+			$uploads = wp_upload_dir();
3984
+			$uploads_dir = $uploads['path'];
3985
+			$uploads_subdir = $uploads['subdir'];
3986 3986
             
3987
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3988
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3987
+			$csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3988
+			$import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3989 3989
             
3990
-            $csv_file_arr = explode( '/', $csv_file );
3991
-            $csv_filename = end( $csv_file_arr );
3992
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3990
+			$csv_file_arr = explode( '/', $csv_file );
3991
+			$csv_filename = end( $csv_file_arr );
3992
+			$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3993 3993
             
3994
-            $json['file'] = $csv_file;
3995
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3994
+			$json['file'] = $csv_file;
3995
+			$json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3996 3996
 
3997
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3998
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3997
+			if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3998
+				$wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3999 3999
                 
4000
-                if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4001
-                    $json['error'] = NULL;
4002
-                    $json['rows'] = 0;
4000
+				if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
4001
+					$json['error'] = NULL;
4002
+					$json['rows'] = 0;
4003 4003
                     
4004
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4005
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4006
-                            if ( !empty( $data ) ) {
4007
-                                $file[] = $data;
4008
-                            }
4009
-                        }
4010
-                        fclose($handle);
4011
-                    }
4004
+					if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
4005
+						while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
4006
+							if ( !empty( $data ) ) {
4007
+								$file[] = $data;
4008
+							}
4009
+						}
4010
+						fclose($handle);
4011
+					}
4012 4012
 
4013
-                    $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
4013
+					$json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
4014 4014
                     
4015
-                    if (!$json['rows'] > 0) {
4016
-                        $json['error'] = __('No data found in csv file.', 'geodirectory');
4017
-                    }
4018
-                } else {
4019
-                    wp_send_json( $json );
4020
-                }
4021
-            } else {
4022
-                wp_send_json( $json );
4023
-            }
4015
+					if (!$json['rows'] > 0) {
4016
+						$json['error'] = __('No data found in csv file.', 'geodirectory');
4017
+					}
4018
+				} else {
4019
+					wp_send_json( $json );
4020
+				}
4021
+			} else {
4022
+				wp_send_json( $json );
4023
+			}
4024 4024
             
4025
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4026
-                wp_send_json( $json );
4027
-            }
4025
+			if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
4026
+				wp_send_json( $json );
4027
+			}
4028 4028
             
4029
-            $total = $json['rows'];
4030
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4031
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4029
+			$total = $json['rows'];
4030
+			$limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
4031
+			$processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
4032 4032
             
4033
-            $count = $limit;
4034
-            $requested_limit = $limit;
4033
+			$count = $limit;
4034
+			$requested_limit = $limit;
4035 4035
             
4036
-            if ($count < $total) {
4037
-                $count = $processed + $count;
4038
-                if ($count > $total) {
4039
-                    $count = $total;
4040
-                }
4041
-            } else {
4042
-                $count = $total;
4043
-            }
4036
+			if ($count < $total) {
4037
+				$count = $processed + $count;
4038
+				if ($count > $total) {
4039
+					$count = $total;
4040
+				}
4041
+			} else {
4042
+				$count = $total;
4043
+			}
4044 4044
             
4045
-            $created = 0;
4046
-            $updated = 0;
4047
-            $skipped = 0;
4048
-            $invalid = 0;
4049
-            $invalid_addr = 0;
4050
-            $images = 0;
4045
+			$created = 0;
4046
+			$updated = 0;
4047
+			$skipped = 0;
4048
+			$invalid = 0;
4049
+			$invalid_addr = 0;
4050
+			$images = 0;
4051 4051
             
4052
-            $invalid_title = 0;
4053
-            $customKeyarray = array();
4054
-            $gd_post_info = array();
4055
-            $post_location = array();
4056
-            $countpost = 0;
4052
+			$invalid_title = 0;
4053
+			$customKeyarray = array();
4054
+			$gd_post_info = array();
4055
+			$post_location = array();
4056
+			$countpost = 0;
4057 4057
             
4058
-            $post_types = geodir_get_posttypes();
4058
+			$post_types = geodir_get_posttypes();
4059 4059
 
4060
-            if ( $task == 'import_cat' ) {				
4061
-                if (!empty($file)) {
4062
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4060
+			if ( $task == 'import_cat' ) {				
4061
+				if (!empty($file)) {
4062
+					$columns = isset($file[0]) ? $file[0] : NULL;
4063 4063
                     
4064
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4065
-                        $json['error'] = CSV_INVAILD_FILE;
4066
-                        wp_send_json( $json );
4067
-                        exit;
4068
-                    }
4064
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4065
+						$json['error'] = CSV_INVAILD_FILE;
4066
+						wp_send_json( $json );
4067
+						exit;
4068
+					}
4069 4069
                     
4070
-                    for ($i = 1; $i <= $limit; $i++) {
4071
-                        $index = $processed + $i;
4070
+					for ($i = 1; $i <= $limit; $i++) {
4071
+						$index = $processed + $i;
4072 4072
                         
4073
-                        if (isset($file[$index])) {
4074
-                            $row = $file[$index];
4075
-                            $row = array_map( 'trim', $row );
4076
-                            //$row = array_map( 'utf8_encode', $row );
4073
+						if (isset($file[$index])) {
4074
+							$row = $file[$index];
4075
+							$row = array_map( 'trim', $row );
4076
+							//$row = array_map( 'utf8_encode', $row );
4077 4077
                             
4078
-                            $cat_id = '';
4079
-                            $cat_name = '';
4080
-                            $cat_slug = '';
4081
-                            $cat_posttype = '';
4082
-                            $cat_parent = '';
4083
-                            $cat_description = '';
4084
-                            $cat_schema = '';
4085
-                            $cat_top_description = '';
4086
-                            $cat_image = '';
4087
-                            $cat_icon = '';
4088
-                            $cat_language = '';
4078
+							$cat_id = '';
4079
+							$cat_name = '';
4080
+							$cat_slug = '';
4081
+							$cat_posttype = '';
4082
+							$cat_parent = '';
4083
+							$cat_description = '';
4084
+							$cat_schema = '';
4085
+							$cat_top_description = '';
4086
+							$cat_image = '';
4087
+							$cat_icon = '';
4088
+							$cat_language = '';
4089 4089
                             
4090
-                            $c = 0;
4091
-                            foreach ($columns as $column ) {
4092
-                                if ( $column == 'cat_id' ) {
4093
-                                    $cat_id = (int)$row[$c];
4094
-                                } else if ( $column == 'cat_name' ) {
4095
-                                    $cat_name = $row[$c];
4096
-                                } else if ( $column == 'cat_slug' ) {
4097
-                                    $cat_slug = $row[$c];
4098
-                                } else if ( $column == 'cat_posttype' ) {
4099
-                                    $cat_posttype = $row[$c];
4100
-                                } else if ( $column == 'cat_parent' ) {
4101
-                                    $cat_parent = trim($row[$c]);
4102
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4103
-                                    $cat_schema = $row[$c];
4104
-                                } else if ( $column == 'cat_description' ) {
4105
-                                    $cat_description = $row[$c];
4106
-                                } else if ( $column == 'cat_top_description' ) {
4107
-                                    $cat_top_description = $row[$c];
4108
-                                } else if ( $column == 'cat_image' ) {
4109
-                                    $cat_image = $row[$c];
4110
-                                } else if ( $column == 'cat_icon' ) {
4111
-                                    $cat_icon = $row[$c];
4112
-                                }
4113
-                                // WPML
4114
-                                if ($is_wpml && $column == 'cat_language') {
4115
-                                    $cat_language = geodir_strtolower(trim($row[$c]));
4116
-                                }
4117
-                                // WPML
4118
-                                $c++;
4119
-                            }
4090
+							$c = 0;
4091
+							foreach ($columns as $column ) {
4092
+								if ( $column == 'cat_id' ) {
4093
+									$cat_id = (int)$row[$c];
4094
+								} else if ( $column == 'cat_name' ) {
4095
+									$cat_name = $row[$c];
4096
+								} else if ( $column == 'cat_slug' ) {
4097
+									$cat_slug = $row[$c];
4098
+								} else if ( $column == 'cat_posttype' ) {
4099
+									$cat_posttype = $row[$c];
4100
+								} else if ( $column == 'cat_parent' ) {
4101
+									$cat_parent = trim($row[$c]);
4102
+								} else if ( $column == 'cat_schema' && $row[$c] != '' ) {
4103
+									$cat_schema = $row[$c];
4104
+								} else if ( $column == 'cat_description' ) {
4105
+									$cat_description = $row[$c];
4106
+								} else if ( $column == 'cat_top_description' ) {
4107
+									$cat_top_description = $row[$c];
4108
+								} else if ( $column == 'cat_image' ) {
4109
+									$cat_image = $row[$c];
4110
+								} else if ( $column == 'cat_icon' ) {
4111
+									$cat_icon = $row[$c];
4112
+								}
4113
+								// WPML
4114
+								if ($is_wpml && $column == 'cat_language') {
4115
+									$cat_language = geodir_strtolower(trim($row[$c]));
4116
+								}
4117
+								// WPML
4118
+								$c++;
4119
+							}
4120 4120
                             
4121
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4122
-                                $invalid++;
4123
-                                continue;
4124
-                            }
4121
+							if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
4122
+								$invalid++;
4123
+								continue;
4124
+							}
4125 4125
                             
4126
-                            // WPML
4127
-                            if ($is_wpml && $cat_language != '') {
4128
-                                $sitepress->switch_lang($cat_language, true);
4129
-                            }
4130
-                            // WPML
4126
+							// WPML
4127
+							if ($is_wpml && $cat_language != '') {
4128
+								$sitepress->switch_lang($cat_language, true);
4129
+							}
4130
+							// WPML
4131 4131
                                                         
4132
-                            $term_data = array();
4133
-                            $term_data['name'] = $cat_name;
4134
-                            $term_data['slug'] = $cat_slug;
4135
-                            $term_data['description'] = $cat_description;
4136
-                            $term_data['cat_schema'] = $cat_schema;
4137
-                            $term_data['top_description'] = $cat_top_description;
4138
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4139
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4132
+							$term_data = array();
4133
+							$term_data['name'] = $cat_name;
4134
+							$term_data['slug'] = $cat_slug;
4135
+							$term_data['description'] = $cat_description;
4136
+							$term_data['cat_schema'] = $cat_schema;
4137
+							$term_data['top_description'] = $cat_top_description;
4138
+							$term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
4139
+							$term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
4140 4140
                             
4141
-                            //$term_data = array_map( 'utf8_encode', $term_data );
4141
+							//$term_data = array_map( 'utf8_encode', $term_data );
4142 4142
                             
4143
-                            $taxonomy = $cat_posttype . 'category';
4143
+							$taxonomy = $cat_posttype . 'category';
4144 4144
                             
4145
-                            $term_data['taxonomy'] = $taxonomy;
4145
+							$term_data['taxonomy'] = $taxonomy;
4146 4146
 
4147
-                            $term_parent_id = 0;
4148
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
4149
-                                $term_parent = '';
4147
+							$term_parent_id = 0;
4148
+							if ($cat_parent != "" || (int)$cat_parent > 0) {
4149
+								$term_parent = '';
4150 4150
                                 
4151
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4152
-                                    $term_parent = $term_parent;
4153
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4154
-                                    $term_parent = $term_parent;
4155
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4156
-                                    $term_parent = $term_parent;
4157
-                                } else {
4158
-                                    $term_parent_data = array();
4159
-                                    $term_parent_data['name'] = $cat_parent;											
4160
-                                    //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );										
4161
-                                    $term_parent_data['taxonomy'] = $taxonomy;
4151
+								if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
4152
+									$term_parent = $term_parent;
4153
+								} else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
4154
+									$term_parent = $term_parent;
4155
+								} else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
4156
+									$term_parent = $term_parent;
4157
+								} else {
4158
+									$term_parent_data = array();
4159
+									$term_parent_data['name'] = $cat_parent;											
4160
+									//$term_parent_data = array_map( 'utf8_encode', $term_parent_data );										
4161
+									$term_parent_data['taxonomy'] = $taxonomy;
4162 4162
                                     
4163
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4164
-                                }
4163
+									$term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
4164
+								}
4165 4165
                                 
4166
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4167
-                                    $term_parent_id = (int)$term_parent->term_id;
4168
-                                }
4169
-                            }
4170
-                            $term_data['parent'] = (int)$term_parent_id;
4166
+								if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
4167
+									$term_parent_id = (int)$term_parent->term_id;
4168
+								}
4169
+							}
4170
+							$term_data['parent'] = (int)$term_parent_id;
4171 4171
 
4172
-                            $term_id = NULL;
4173
-                            if ( $import_choice == 'update' ) {
4174
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4175
-                                    $term_data['term_id'] = $term['term_id'];
4172
+							$term_id = NULL;
4173
+							if ( $import_choice == 'update' ) {
4174
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4175
+									$term_data['term_id'] = $term['term_id'];
4176 4176
                                     
4177
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4178
-                                        $updated++;
4179
-                                    } else {
4180
-                                        $invalid++;
4181
-                                    }
4182
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4183
-                                    $term_data['term_id'] = $term['term_id'];
4177
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4178
+										$updated++;
4179
+									} else {
4180
+										$invalid++;
4181
+									}
4182
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4183
+									$term_data['term_id'] = $term['term_id'];
4184 4184
                                     
4185
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4186
-                                        $updated++;
4187
-                                    } else {
4188
-                                        $invalid++;
4189
-                                    }
4190
-                                } else {
4191
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4192
-                                        $created++;
4193
-                                    } else {
4194
-                                        $invalid++;
4195
-                                    }
4196
-                                }
4197
-                            } else if ( $import_choice == 'skip' ) {
4198
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4199
-                                    $skipped++;
4200
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4201
-                                    $skipped++;
4202
-                                } else {
4203
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {										
4204
-                                        $created++;
4205
-                                    } else {
4206
-                                        $invalid++;
4207
-                                    }
4208
-                                }
4209
-                            } else {
4210
-                                $invalid++;
4211
-                            }
4185
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
4186
+										$updated++;
4187
+									} else {
4188
+										$invalid++;
4189
+									}
4190
+								} else {
4191
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
4192
+										$created++;
4193
+									} else {
4194
+										$invalid++;
4195
+									}
4196
+								}
4197
+							} else if ( $import_choice == 'skip' ) {
4198
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
4199
+									$skipped++;
4200
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
4201
+									$skipped++;
4202
+								} else {
4203
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {										
4204
+										$created++;
4205
+									} else {
4206
+										$invalid++;
4207
+									}
4208
+								}
4209
+							} else {
4210
+								$invalid++;
4211
+							}
4212 4212
                             
4213
-                            if ( $term_id ) {
4214
-                                if ( isset( $term_data['top_description'] ) ) {
4215
-                                    update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4216
-                                }
4213
+							if ( $term_id ) {
4214
+								if ( isset( $term_data['top_description'] ) ) {
4215
+									update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
4216
+								}
4217 4217
                                 
4218
-                                if ( isset( $term_data['cat_schema'] ) ) {
4219
-                                    update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4220
-                                }
4218
+								if ( isset( $term_data['cat_schema'] ) ) {
4219
+									update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
4220
+								}
4221 4221
             
4222
-                                $attachment = false;
4223
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4224
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4225
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4222
+								$attachment = false;
4223
+								if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
4224
+									$cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
4225
+									$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
4226 4226
                                     
4227
-                                    if ( basename($cat_image) != $term_data['image'] ) {
4228
-                                        $attachment = true;
4229
-                                        update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4230
-                                    }
4231
-                                }
4227
+									if ( basename($cat_image) != $term_data['image'] ) {
4228
+										$attachment = true;
4229
+										update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4230
+									}
4231
+								}
4232 4232
                                 
4233
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4234
-                                    $cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4235
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4233
+								if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4234
+									$cat_icon = get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4235
+									$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4236 4236
                                         
4237
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4238
-                                        $attachment = true;
4239
-                                        update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4240
-                                    }
4241
-                                }
4237
+									if ( basename($cat_icon) != $term_data['icon'] ) {
4238
+										$attachment = true;
4239
+										update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4240
+									}
4241
+								}
4242 4242
                                 
4243
-                                if ( $attachment ) {
4244
-                                    $images++;
4245
-                                }
4246
-                            }
4243
+								if ( $attachment ) {
4244
+									$images++;
4245
+								}
4246
+							}
4247 4247
                             
4248
-                            // WPML
4249
-                            if ($is_wpml && $cat_language != '') {
4250
-                                $sitepress->switch_lang($active_lang, true);
4251
-                            }
4252
-                            // WPML
4253
-                        }
4254
-                    }
4255
-                }
4248
+							// WPML
4249
+							if ($is_wpml && $cat_language != '') {
4250
+								$sitepress->switch_lang($active_lang, true);
4251
+							}
4252
+							// WPML
4253
+						}
4254
+					}
4255
+				}
4256 4256
                 
4257
-                $json = array();
4258
-                $json['processed'] = $limit;
4259
-                $json['created'] = $created;
4260
-                $json['updated'] = $updated;
4261
-                $json['skipped'] = $skipped;
4262
-                $json['invalid'] = $invalid;
4263
-                $json['images'] = $images;
4257
+				$json = array();
4258
+				$json['processed'] = $limit;
4259
+				$json['created'] = $created;
4260
+				$json['updated'] = $updated;
4261
+				$json['skipped'] = $skipped;
4262
+				$json['invalid'] = $invalid;
4263
+				$json['images'] = $images;
4264 4264
                 
4265
-                wp_send_json( $json );
4266
-                exit;
4267
-            } else if ( $task == 'import_post' ) {
4268
-
4269
-                //run some stuff to make the import quicker
4270
-                wp_defer_term_counting( true );
4271
-                wp_defer_comment_counting( true );
4272
-                $wpdb->query( 'SET autocommit = 0;' );
4273
-
4274
-                //remove_all_actions('publish_post');
4275
-                //remove_all_actions('transition_post_status');
4276
-                //remove_all_actions('publish_future_post');
4277
-
4278
-                if (!empty($file)) {
4279
-                    $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4280
-                    $default_status = 'publish';
4281
-                    $current_date = date_i18n( 'Y-m-d', time() );
4265
+				wp_send_json( $json );
4266
+				exit;
4267
+			} else if ( $task == 'import_post' ) {
4268
+
4269
+				//run some stuff to make the import quicker
4270
+				wp_defer_term_counting( true );
4271
+				wp_defer_comment_counting( true );
4272
+				$wpdb->query( 'SET autocommit = 0;' );
4273
+
4274
+				//remove_all_actions('publish_post');
4275
+				//remove_all_actions('transition_post_status');
4276
+				//remove_all_actions('publish_future_post');
4277
+
4278
+				if (!empty($file)) {
4279
+					$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4280
+					$default_status = 'publish';
4281
+					$current_date = date_i18n( 'Y-m-d', time() );
4282 4282
                     
4283
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4283
+					$columns = isset($file[0]) ? $file[0] : NULL;
4284 4284
                     
4285
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4286
-                        $json['error'] = CSV_INVAILD_FILE;
4287
-                        wp_send_json( $json );
4288
-                        exit;
4289
-                    }
4285
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4286
+						$json['error'] = CSV_INVAILD_FILE;
4287
+						wp_send_json( $json );
4288
+						exit;
4289
+					}
4290 4290
 
4291
-                    $processed_actual=0;
4292
-                    for ($i = 1; $i <= $limit; $i++) {
4293
-                        $index = $processed + $i;
4294
-                        $gd_post = array();
4291
+					$processed_actual=0;
4292
+					for ($i = 1; $i <= $limit; $i++) {
4293
+						$index = $processed + $i;
4294
+						$gd_post = array();
4295 4295
                         
4296
-                        if (isset($file[$index])) {$processed_actual++;
4297
-                            $row = $file[$index];
4298
-                            $row = array_map( 'trim', $row );
4299
-                            //$row = array_map( 'utf8_encode', $row );
4300
-                            $row = array_map( 'addslashes_gpc', $row );
4296
+						if (isset($file[$index])) {$processed_actual++;
4297
+							$row = $file[$index];
4298
+							$row = array_map( 'trim', $row );
4299
+							//$row = array_map( 'utf8_encode', $row );
4300
+							$row = array_map( 'addslashes_gpc', $row );
4301 4301
                             
4302
-                            $post_id = '';
4303
-                            $post_title = '';
4304
-                            $post_author = '';
4305
-                            $post_content = '';
4306
-                            $post_category_arr = array();
4307
-                            $default_category = '';
4308
-                            $post_tags = array();
4309
-                            $post_type = '';
4310
-                            $post_status = '';
4311
-                            $geodir_video = '';
4312
-                            $post_address = '';
4313
-                            $post_city = '';
4314
-                            $post_region = '';
4315
-                            $post_country = '';
4316
-                            $post_zip = '';
4317
-                            $post_latitude = '';
4318
-                            $post_longitude = '';
4319
-                            $post_neighbourhood = '';
4320
-                            $neighbourhood_latitude = '';
4321
-                            $neighbourhood_longitude = '';
4322
-                            $geodir_timing = '';
4323
-                            $geodir_contact = '';
4324
-                            $geodir_email = '';
4325
-                            $geodir_website = '';
4326
-                            $geodir_twitter = '';
4327
-                            $geodir_facebook = '';
4328
-                            $geodir_twitter = '';
4329
-                            $post_images = array();
4302
+							$post_id = '';
4303
+							$post_title = '';
4304
+							$post_author = '';
4305
+							$post_content = '';
4306
+							$post_category_arr = array();
4307
+							$default_category = '';
4308
+							$post_tags = array();
4309
+							$post_type = '';
4310
+							$post_status = '';
4311
+							$geodir_video = '';
4312
+							$post_address = '';
4313
+							$post_city = '';
4314
+							$post_region = '';
4315
+							$post_country = '';
4316
+							$post_zip = '';
4317
+							$post_latitude = '';
4318
+							$post_longitude = '';
4319
+							$post_neighbourhood = '';
4320
+							$neighbourhood_latitude = '';
4321
+							$neighbourhood_longitude = '';
4322
+							$geodir_timing = '';
4323
+							$geodir_contact = '';
4324
+							$geodir_email = '';
4325
+							$geodir_website = '';
4326
+							$geodir_twitter = '';
4327
+							$geodir_facebook = '';
4328
+							$geodir_twitter = '';
4329
+							$post_images = array();
4330 4330
                             
4331
-                            $expire_date = 'Never';
4331
+							$expire_date = 'Never';
4332 4332
                             
4333
-                            $language = '';
4334
-                            $original_post_id = '';
4333
+							$language = '';
4334
+							$original_post_id = '';
4335 4335
                                                         
4336
-                            $c = 0;
4337
-                            foreach ($columns as $column ) {
4338
-                                $gd_post[$column] = $row[$c];
4336
+							$c = 0;
4337
+							foreach ($columns as $column ) {
4338
+								$gd_post[$column] = $row[$c];
4339 4339
                                 
4340
-                                if ( $column == 'post_id' ) {
4341
-                                    $post_id = $row[$c];
4342
-                                } else if ( $column == 'post_title' ) {
4343
-                                    $post_title = sanitize_text_field($row[$c]);
4344
-                                } else if ( $column == 'post_author' ) {
4345
-                                    $post_author = $row[$c];
4346
-                                } else if ( $column == 'post_content' ) {
4347
-                                    $post_content = $row[$c];
4348
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4349
-                                    $post_category_arr = explode( ',', $row[$c] );
4350
-                                } else if ( $column == 'default_category' ) {
4351
-                                    $default_category = wp_kses_normalize_entities($row[$c]);
4352
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4353
-                                    $post_tags = explode( ',', $row[$c] );
4354
-                                } else if ( $column == 'post_type' ) {
4355
-                                    $post_type = $row[$c];
4356
-                                } else if ( $column == 'post_status' ) {
4357
-                                    $post_status = sanitize_key( $row[$c] );
4358
-                                } else if ( $column == 'is_featured' ) {
4359
-                                    $is_featured = (int)$row[$c];
4360
-                                } else if ( $column == 'geodir_video' ) {
4361
-                                    $geodir_video = $row[$c];
4362
-                                } else if ( $column == 'post_address' ) {
4363
-                                    $post_address = $row[$c];
4364
-                                } else if ( $column == 'post_city' ) {
4365
-                                    $post_city = $row[$c];
4366
-                                } else if ( $column == 'post_region' ) {
4367
-                                    $post_region = $row[$c];
4368
-                                } else if ( $column == 'post_country' ) {
4369
-                                    $post_country = $row[$c];
4370
-                                } else if ( $column == 'post_zip' ) {
4371
-                                    $post_zip = $row[$c];
4372
-                                } else if ( $column == 'post_latitude' ) {
4373
-                                    $post_latitude = $row[$c];
4374
-                                } else if ( $column == 'post_longitude' ) {
4375
-                                    $post_longitude = $row[$c];
4376
-                                } else if ( $column == 'post_neighbourhood' ) {
4377
-                                    $post_neighbourhood = $row[$c];
4378
-                                    unset($gd_post[$column]);
4379
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4380
-                                    $neighbourhood_latitude = $row[$c];
4381
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4382
-                                    $neighbourhood_longitude = $row[$c];
4383
-                                } else if ( $column == 'geodir_timing' ) {
4384
-                                    $geodir_timing = $row[$c];
4385
-                                } else if ( $column == 'geodir_contact' ) {
4386
-                                    $geodir_contact = $row[$c];
4387
-                                } else if ( $column == 'geodir_email' ) {
4388
-                                    $geodir_email = $row[$c];
4389
-                                } else if ( $column == 'geodir_website' ) {
4390
-                                    $geodir_website = $row[$c];
4391
-                                } else if ( $column == 'geodir_twitter' ) {
4392
-                                    $geodir_twitter = $row[$c];
4393
-                                } else if ( $column == 'geodir_facebook' ) {
4394
-                                    $geodir_facebook = $row[$c];
4395
-                                } else if ( $column == 'geodir_twitter' ) {
4396
-                                    $geodir_twitter = $row[$c];
4397
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4398
-                                    $post_images[] = $row[$c];
4399
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4400
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4401
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4402
-                                    $row[$c] = str_replace('/', '-', $row[$c]);
4403
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4404
-                                }
4405
-                                // WPML
4406
-                                if ($is_wpml) {
4407
-                                    if ($column == 'language') {
4408
-                                        $language = geodir_strtolower(trim($row[$c]));
4409
-                                    } else if ($column == 'original_post_id') {
4410
-                                        $original_post_id = (int)$row[$c];
4411
-                                    }
4412
-                                }
4413
-                                // WPML
4414
-                                $c++;
4415
-                            }
4340
+								if ( $column == 'post_id' ) {
4341
+									$post_id = $row[$c];
4342
+								} else if ( $column == 'post_title' ) {
4343
+									$post_title = sanitize_text_field($row[$c]);
4344
+								} else if ( $column == 'post_author' ) {
4345
+									$post_author = $row[$c];
4346
+								} else if ( $column == 'post_content' ) {
4347
+									$post_content = $row[$c];
4348
+								} else if ( $column == 'post_category' && $row[$c] != '' ) {
4349
+									$post_category_arr = explode( ',', $row[$c] );
4350
+								} else if ( $column == 'default_category' ) {
4351
+									$default_category = wp_kses_normalize_entities($row[$c]);
4352
+								} else if ( $column == 'post_tags' && $row[$c] != '' ) {
4353
+									$post_tags = explode( ',', $row[$c] );
4354
+								} else if ( $column == 'post_type' ) {
4355
+									$post_type = $row[$c];
4356
+								} else if ( $column == 'post_status' ) {
4357
+									$post_status = sanitize_key( $row[$c] );
4358
+								} else if ( $column == 'is_featured' ) {
4359
+									$is_featured = (int)$row[$c];
4360
+								} else if ( $column == 'geodir_video' ) {
4361
+									$geodir_video = $row[$c];
4362
+								} else if ( $column == 'post_address' ) {
4363
+									$post_address = $row[$c];
4364
+								} else if ( $column == 'post_city' ) {
4365
+									$post_city = $row[$c];
4366
+								} else if ( $column == 'post_region' ) {
4367
+									$post_region = $row[$c];
4368
+								} else if ( $column == 'post_country' ) {
4369
+									$post_country = $row[$c];
4370
+								} else if ( $column == 'post_zip' ) {
4371
+									$post_zip = $row[$c];
4372
+								} else if ( $column == 'post_latitude' ) {
4373
+									$post_latitude = $row[$c];
4374
+								} else if ( $column == 'post_longitude' ) {
4375
+									$post_longitude = $row[$c];
4376
+								} else if ( $column == 'post_neighbourhood' ) {
4377
+									$post_neighbourhood = $row[$c];
4378
+									unset($gd_post[$column]);
4379
+								} else if ( $column == 'neighbourhood_latitude' ) {
4380
+									$neighbourhood_latitude = $row[$c];
4381
+								} else if ( $column == 'neighbourhood_longitude' ) {
4382
+									$neighbourhood_longitude = $row[$c];
4383
+								} else if ( $column == 'geodir_timing' ) {
4384
+									$geodir_timing = $row[$c];
4385
+								} else if ( $column == 'geodir_contact' ) {
4386
+									$geodir_contact = $row[$c];
4387
+								} else if ( $column == 'geodir_email' ) {
4388
+									$geodir_email = $row[$c];
4389
+								} else if ( $column == 'geodir_website' ) {
4390
+									$geodir_website = $row[$c];
4391
+								} else if ( $column == 'geodir_twitter' ) {
4392
+									$geodir_twitter = $row[$c];
4393
+								} else if ( $column == 'geodir_facebook' ) {
4394
+									$geodir_facebook = $row[$c];
4395
+								} else if ( $column == 'geodir_twitter' ) {
4396
+									$geodir_twitter = $row[$c];
4397
+								} else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4398
+									$post_images[] = $row[$c];
4399
+								} else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4400
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4401
+								} else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4402
+									$row[$c] = str_replace('/', '-', $row[$c]);
4403
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4404
+								}
4405
+								// WPML
4406
+								if ($is_wpml) {
4407
+									if ($column == 'language') {
4408
+										$language = geodir_strtolower(trim($row[$c]));
4409
+									} else if ($column == 'original_post_id') {
4410
+										$original_post_id = (int)$row[$c];
4411
+									}
4412
+								}
4413
+								// WPML
4414
+								$c++;
4415
+							}
4416 4416
                             
4417
-                            // WPML
4418
-                            if ($is_wpml && $language != '') {
4419
-                                $sitepress->switch_lang($language, true);
4420
-                            }
4421
-                            // WPML
4417
+							// WPML
4418
+							if ($is_wpml && $language != '') {
4419
+								$sitepress->switch_lang($language, true);
4420
+							}
4421
+							// WPML
4422 4422
 
4423
-                            $gd_post['IMAGE'] = $post_images;
4423
+							$gd_post['IMAGE'] = $post_images;
4424 4424
                             
4425
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4426
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4425
+							$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4426
+							$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4427 4427
                                                                                                                 
4428
-                            $valid = true;
4428
+							$valid = true;
4429 4429
                             
4430
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4431
-                                $invalid++;
4432
-                                $valid = false;
4433
-                            }
4430
+							if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4431
+								$invalid++;
4432
+								$valid = false;
4433
+							}
4434 4434
                             
4435
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4436
-                            if ( $location_allowed ) {
4437
-                                $location_result = geodir_get_default_location();
4438
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4439
-                                    $invalid_addr++;
4440
-                                    $valid = false;
4441
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4442
-                                    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 ) ) ) {
4443
-                                        $invalid_addr++;
4444
-                                        $valid = false;
4445
-                                    } else {
4446
-                                        if (!$location_manager) {
4447
-                                            $gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
4448
-                                        }
4449
-                                    }
4450
-                                }
4451
-                            }
4435
+							$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4436
+							if ( $location_allowed ) {
4437
+								$location_result = geodir_get_default_location();
4438
+								if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4439
+									$invalid_addr++;
4440
+									$valid = false;
4441
+								} else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4442
+									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 ) ) ) {
4443
+										$invalid_addr++;
4444
+										$valid = false;
4445
+									} else {
4446
+										if (!$location_manager) {
4447
+											$gd_post['post_locations'] = '[' . $location_result->city_slug . '],[' . $location_result->region_slug . '],[' . $location_result->country_slug . ']'; // Set the default location when location manager not activated.
4448
+										}
4449
+									}
4450
+								}
4451
+							}
4452 4452
                             
4453
-                            if ( !$valid ) {
4454
-                                continue;
4455
-                            }
4453
+							if ( !$valid ) {
4454
+								continue;
4455
+							}
4456 4456
 
4457
-                            $cat_taxonomy = $post_type . 'category';
4458
-                            $tags_taxonomy = $post_type . '_tags';
4457
+							$cat_taxonomy = $post_type . 'category';
4458
+							$tags_taxonomy = $post_type . '_tags';
4459 4459
                             
4460
-                            if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4461
-                                $post_category_arr = array_merge(array($default_category), $post_category_arr);
4462
-                            }
4460
+							if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4461
+								$post_category_arr = array_merge(array($default_category), $post_category_arr);
4462
+							}
4463 4463
 
4464
-                            $post_category = array();
4465
-                            $default_category_id = NULL;
4466
-                            if ( !empty( $post_category_arr ) ) {
4467
-                                foreach ( $post_category_arr as $value ) {
4468
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4464
+							$post_category = array();
4465
+							$default_category_id = NULL;
4466
+							if ( !empty( $post_category_arr ) ) {
4467
+								foreach ( $post_category_arr as $value ) {
4468
+									$category_name = wp_kses_normalize_entities( trim( $value ) );
4469 4469
                                     
4470
-                                    if ( $category_name != '' ) {
4471
-                                        $term_category = array();
4470
+									if ( $category_name != '' ) {
4471
+										$term_category = array();
4472 4472
                                         
4473
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4474
-                                            $term_category = $term;
4475
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4476
-                                            $term_category = $term;
4477
-                                        } else {
4478
-                                            $term_data = array();
4479
-                                            $term_data['name'] = $category_name;
4480
-                                            $term_data['taxonomy'] = $cat_taxonomy;
4473
+										if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4474
+											$term_category = $term;
4475
+										} else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4476
+											$term_category = $term;
4477
+										} else {
4478
+											$term_data = array();
4479
+											$term_data['name'] = $category_name;
4480
+											$term_data['taxonomy'] = $cat_taxonomy;
4481 4481
                                             
4482
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4483
-                                            if ( $term_id ) {
4484
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4485
-                                            }
4486
-                                        }
4482
+											$term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4483
+											if ( $term_id ) {
4484
+												$term_category = get_term( $term_id, $cat_taxonomy );
4485
+											}
4486
+										}
4487 4487
                                         
4488
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4489
-                                            $post_category[] = intval($term_category->term_id);
4488
+										if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4489
+											$post_category[] = intval($term_category->term_id);
4490 4490
                                             
4491
-                                            if ($category_name == $default_category) {
4492
-                                                $default_category_id = intval($term_category->term_id);
4493
-                                            }
4494
-                                        }
4495
-                                    }
4496
-                                }
4497
-                            }
4491
+											if ($category_name == $default_category) {
4492
+												$default_category_id = intval($term_category->term_id);
4493
+											}
4494
+										}
4495
+									}
4496
+								}
4497
+							}
4498 4498
 
4499
-                            $save_post = array();
4500
-                            $save_post['post_title'] = $post_title;
4501
-                            $save_post['post_content'] = $post_content;
4502
-                            $save_post['post_type'] = $post_type;
4503
-                            $save_post['post_author'] = $post_author;
4504
-                            $save_post['post_status'] = $post_status;
4505
-                            $save_post['post_category'] = $post_category;
4506
-                            $save_post['post_tags'] = $post_tags;
4507
-
4508
-                            $saved_post_id = NULL;
4509
-                            if ( $import_choice == 'update' ) {
4510
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4511
-                                    $save_post['ID'] = $post_id;
4499
+							$save_post = array();
4500
+							$save_post['post_title'] = $post_title;
4501
+							$save_post['post_content'] = $post_content;
4502
+							$save_post['post_type'] = $post_type;
4503
+							$save_post['post_author'] = $post_author;
4504
+							$save_post['post_status'] = $post_status;
4505
+							$save_post['post_category'] = $post_category;
4506
+							$save_post['post_tags'] = $post_tags;
4507
+
4508
+							$saved_post_id = NULL;
4509
+							if ( $import_choice == 'update' ) {
4510
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4511
+									$save_post['ID'] = $post_id;
4512 4512
                                     
4513
-                                    if ( wp_update_post( $save_post ) ) {
4514
-                                        $saved_post_id = $post_id;
4515
-                                        $updated++;
4516
-                                    }
4517
-                                } else {
4518
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4519
-                                        $created++;
4520
-                                    }
4521
-                                }
4513
+									if ( wp_update_post( $save_post ) ) {
4514
+										$saved_post_id = $post_id;
4515
+										$updated++;
4516
+									}
4517
+								} else {
4518
+									if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4519
+										$created++;
4520
+									}
4521
+								}
4522 4522
                                 
4523
-                                if ( !$saved_post_id > 0 ) {
4524
-                                    $invalid++;
4525
-                                }
4526
-                            } else if ( $import_choice == 'skip' ) {
4527
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4528
-                                    $skipped++;	
4529
-                                } else {
4530
-                                    if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4531
-                                        $created++;	
4532
-                                    } else {
4533
-                                        $invalid++;
4534
-                                    }
4535
-                                }
4536
-                            } else {
4537
-                                $invalid++;
4538
-                            }
4523
+								if ( !$saved_post_id > 0 ) {
4524
+									$invalid++;
4525
+								}
4526
+							} else if ( $import_choice == 'skip' ) {
4527
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4528
+									$skipped++;	
4529
+								} else {
4530
+									if ( $saved_post_id = wp_insert_post( $save_post ) ) {
4531
+										$created++;	
4532
+									} else {
4533
+										$invalid++;
4534
+									}
4535
+								}
4536
+							} else {
4537
+								$invalid++;
4538
+							}
4539 4539
 
4540
-                            if ( (int)$saved_post_id > 0 ) {
4541
-                                // WPML
4542
-                                if ($is_wpml && $original_post_id > 0 && $language != '') {
4543
-                                    $wpml_post_type = 'post_' . $post_type;
4544
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4545
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4540
+							if ( (int)$saved_post_id > 0 ) {
4541
+								// WPML
4542
+								if ($is_wpml && $original_post_id > 0 && $language != '') {
4543
+									$wpml_post_type = 'post_' . $post_type;
4544
+									$source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4545
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4546 4546
 
4547
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4547
+									$trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4548 4548
                                     
4549
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4550
-                                }
4551
-                                // WPML
4552
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4549
+									$sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4550
+								}
4551
+								// WPML
4552
+								$gd_post_info = geodir_get_post_info( $saved_post_id );
4553 4553
                                 
4554
-                                $gd_post['post_id'] = $saved_post_id;
4555
-                                $gd_post['ID'] = $saved_post_id;
4556
-                                $gd_post['post_tags'] = $post_tags;
4557
-                                $gd_post['post_title'] = $post_title;
4558
-                                $gd_post['post_status'] = $post_status;
4559
-                                $gd_post['submit_time'] = time();
4560
-                                $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4554
+								$gd_post['post_id'] = $saved_post_id;
4555
+								$gd_post['ID'] = $saved_post_id;
4556
+								$gd_post['post_tags'] = $post_tags;
4557
+								$gd_post['post_title'] = $post_title;
4558
+								$gd_post['post_status'] = $post_status;
4559
+								$gd_post['submit_time'] = time();
4560
+								$gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4561 4561
                                                     
4562
-                                // post location
4563
-                                $post_location_id = 0;
4564
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4565
-                                    $gd_post['post_neighbourhood'] = '';
4562
+								// post location
4563
+								$post_location_id = 0;
4564
+								if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4565
+									$gd_post['post_neighbourhood'] = '';
4566 4566
                                     
4567
-                                    $post_location_info = array(
4568
-                                                                'city' => $post_city,
4569
-                                                                'region' => $post_region,
4570
-                                                                'country' => $post_country,
4571
-                                                                'geo_lat' => $post_latitude,
4572
-                                                                'geo_lng' => $post_longitude
4573
-                                                            );
4574
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4575
-                                        $post_location_id = $location_id;
4576
-                                    }
4567
+									$post_location_info = array(
4568
+																'city' => $post_city,
4569
+																'region' => $post_region,
4570
+																'country' => $post_country,
4571
+																'geo_lat' => $post_latitude,
4572
+																'geo_lng' => $post_longitude
4573
+															);
4574
+									if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4575
+										$post_location_id = $location_id;
4576
+									}
4577 4577
                                     
4578
-                                    if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4579
-                                        $neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4578
+									if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4579
+										$neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4580 4580
 
4581
-                                        $hood_data = array();
4582
-                                        $hood_data['hood_location_id'] = $post_location_id;
4583
-                                        $hood_data['hood_name'] = $post_neighbourhood;
4581
+										$hood_data = array();
4582
+										$hood_data['hood_location_id'] = $post_location_id;
4583
+										$hood_data['hood_name'] = $post_neighbourhood;
4584 4584
                                         
4585
-                                        if (!empty($neighbourhood_info)) {
4586
-                                            $hood_data['hood_id'] = $neighbourhood_info->hood_id;
4587
-                                            $hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4585
+										if (!empty($neighbourhood_info)) {
4586
+											$hood_data['hood_id'] = $neighbourhood_info->hood_id;
4587
+											$hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4588 4588
                                             
4589
-                                            if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4590
-                                                $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4591
-                                                $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4592
-                                            }
4593
-                                        }
4589
+											if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4590
+												$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4591
+												$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4592
+											}
4593
+										}
4594 4594
                                         
4595
-                                        if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4596
-                                            $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4597
-                                            $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4598
-                                        }
4595
+										if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4596
+											$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4597
+											$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4598
+										}
4599 4599
                                         
4600
-                                        $hood_data['hood_latitude'] = $post_latitude;
4601
-                                        $hood_data['hood_longitude'] = $post_longitude;
4600
+										$hood_data['hood_latitude'] = $post_latitude;
4601
+										$hood_data['hood_longitude'] = $post_longitude;
4602 4602
 
4603
-                                        $neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4604
-                                        if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4605
-                                            $gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4606
-                                        }
4607
-                                    }
4608
-                                }
4609
-                                $gd_post['post_location_id'] = $post_location_id;
4603
+										$neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4604
+										if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4605
+											$gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4606
+										}
4607
+									}
4608
+								}
4609
+								$gd_post['post_location_id'] = $post_location_id;
4610 4610
                                 
4611
-                                // post package info
4612
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4613
-                                if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4614
-                                    $package_id = $gd_post_info->package_id;
4615
-                                }
4611
+								// post package info
4612
+								$package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4613
+								if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4614
+									$package_id = $gd_post_info->package_id;
4615
+								}
4616 4616
                                 
4617
-                                $package_info = array();
4618
-                                if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4619
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4617
+								$package_info = array();
4618
+								if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4619
+									$package_info = (array)geodir_get_package_info_by_id($package_id);
4620 4620
                                     
4621
-                                    if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4622
-                                        $package_info = array();
4623
-                                    }
4624
-                                }
4621
+									if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4622
+										$package_info = array();
4623
+									}
4624
+								}
4625 4625
                                 
4626
-                                if (empty($package_info)) {
4627
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4628
-                                }
4626
+								if (empty($package_info)) {
4627
+									$package_info = (array)geodir_post_package_info( array(), '', $post_type );
4628
+								}
4629 4629
                                  
4630
-                                if (!empty($package_info))	 {
4631
-                                    $package_id = $package_info['pid'];
4630
+								if (!empty($package_info))	 {
4631
+									$package_id = $package_info['pid'];
4632 4632
                                     
4633
-                                    if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4634
-                                        $gd_post['expire_date'] = $expire_date;
4635
-                                    } else {
4636
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4637
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4638
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4639
-                                        } else {
4640
-                                            $gd_post['expire_date'] = 'Never';
4641
-                                        }
4642
-                                    }
4633
+									if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4634
+										$gd_post['expire_date'] = $expire_date;
4635
+									} else {
4636
+										if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4637
+											$gd_post['alive_days'] = (int)$package_info['days'];
4638
+											$gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4639
+										} else {
4640
+											$gd_post['expire_date'] = 'Never';
4641
+										}
4642
+									}
4643 4643
                                     
4644
-                                    $gd_post['package_id'] = $package_id;
4645
-                                }
4644
+									$gd_post['package_id'] = $package_id;
4645
+								}
4646 4646
 
4647
-                                $table = $plugin_prefix . $post_type . '_detail';
4647
+								$table = $plugin_prefix . $post_type . '_detail';
4648 4648
                                 
4649
-                                if ($post_type == 'gd_event') {
4650
-                                    $gd_post = geodir_imex_process_event_data($gd_post);
4651
-                                }
4649
+								if ($post_type == 'gd_event') {
4650
+									$gd_post = geodir_imex_process_event_data($gd_post);
4651
+								}
4652 4652
                                 
4653
-                                if (isset($gd_post['post_id'])) {
4654
-                                    unset($gd_post['post_id']);
4655
-                                }
4653
+								if (isset($gd_post['post_id'])) {
4654
+									unset($gd_post['post_id']);
4655
+								}
4656 4656
 
4657
-                                // Export franchise fields
4658
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4659
-                                if ($is_franchise_active) {
4660
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4661
-                                        $gd_franchise_lock = array();
4657
+								// Export franchise fields
4658
+								$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4659
+								if ($is_franchise_active) {
4660
+									if ( isset( $gd_post['gd_is_franchise'] ) && (int)$gd_post['gd_is_franchise'] == 1 ) {
4661
+										$gd_franchise_lock = array();
4662 4662
                                         
4663
-                                        if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4664
-                                            $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4665
-                                            $gd_franchise_lock = trim( $gd_franchise_lock );
4666
-                                            $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4667
-                                        }
4663
+										if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4664
+											$gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4665
+											$gd_franchise_lock = trim( $gd_franchise_lock );
4666
+											$gd_franchise_lock = explode( ",", $gd_franchise_lock );
4667
+										}
4668 4668
                                         
4669
-                                        update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4670
-                                        update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4671
-                                    } else {
4672
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4673
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4674
-                                        }
4675
-                                    }
4676
-                                }
4669
+										update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4670
+										update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4671
+									} else {
4672
+										if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4673
+											geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4674
+										}
4675
+									}
4676
+								}
4677 4677
                                 
4678
-                                if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4679
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4680
-                                    if ($default_category_id) {
4681
-                                        $save_post['post_default_category'] = $default_category_id;
4682
-                                        $gd_post['default_category'] = $default_category_id;
4683
-                                    }
4684
-                                    $gd_post[$cat_taxonomy] = $save_post['post_category'];
4685
-                                }
4678
+								if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4679
+									$save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4680
+									if ($default_category_id) {
4681
+										$save_post['post_default_category'] = $default_category_id;
4682
+										$gd_post['default_category'] = $default_category_id;
4683
+									}
4684
+									$gd_post[$cat_taxonomy] = $save_post['post_category'];
4685
+								}
4686 4686
                                 
4687
-                                // Save post info
4688
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4689
-                                // post taxonomies
4690
-                                if ( !empty( $save_post['post_category'] ) ) {
4691
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4687
+								// Save post info
4688
+								geodir_save_post_info( $saved_post_id, $gd_post );
4689
+								// post taxonomies
4690
+								if ( !empty( $save_post['post_category'] ) ) {
4691
+									wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4692 4692
                                     
4693
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4694
-                                    if ($default_category_id) {
4695
-                                        $post_default_category = $default_category_id;
4696
-                                    }
4697
-                                    $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4698
-                                    $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4699
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4693
+									$post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4694
+									if ($default_category_id) {
4695
+										$post_default_category = $default_category_id;
4696
+									}
4697
+									$post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4698
+									$save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4699
+									$post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4700 4700
                                     
4701
-                                    if ($post_category_str != '' && $post_default_category) {
4702
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4703
-                                    }
4701
+									if ($post_category_str != '' && $post_default_category) {
4702
+										$post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4703
+									}
4704 4704
                                     
4705
-                                    $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4705
+									$post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4706 4706
                                     
4707
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4708
-                                }
4707
+									geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4708
+								}
4709 4709
 
4710
-                                if ( !empty( $save_post['post_tags'] ) ) {
4711
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4712
-                                }
4710
+								if ( !empty( $save_post['post_tags'] ) ) {
4711
+									wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4712
+								}
4713 4713
 
4714
-                                // Post images
4715
-                                if ( !empty( $post_images ) ) {
4716
-                                    $post_images = array_unique($post_images);
4714
+								// Post images
4715
+								if ( !empty( $post_images ) ) {
4716
+									$post_images = array_unique($post_images);
4717 4717
                                     
4718
-                                    $old_post_images_arr = array();
4719
-                                    $saved_post_images_arr = array();
4718
+									$old_post_images_arr = array();
4719
+									$saved_post_images_arr = array();
4720 4720
                                     
4721
-                                    $order = 1;
4721
+									$order = 1;
4722 4722
                                     
4723
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4724
-                                    if (!empty($old_post_images)) {
4725
-                                        foreach( $old_post_images as $old_post_image ) {
4726
-                                            if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4727
-                                                $old_post_images_arr[] = $old_post_image->file;
4728
-                                            }
4729
-                                        }
4730
-                                    }
4723
+									$old_post_images = geodir_get_images( $saved_post_id );
4724
+									if (!empty($old_post_images)) {
4725
+										foreach( $old_post_images as $old_post_image ) {
4726
+											if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4727
+												$old_post_images_arr[] = $old_post_image->file;
4728
+											}
4729
+										}
4730
+									}
4731 4731
                                     
4732
-                                    foreach ( $post_images as $post_image ) {
4733
-                                        $image_name = basename( $post_image );
4734
-                                        $saved_post_images_arr[] = $image_name;
4732
+									foreach ( $post_images as $post_image ) {
4733
+										$image_name = basename( $post_image );
4734
+										$saved_post_images_arr[] = $image_name;
4735 4735
                                         
4736
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4737
-                                            continue; // Skip if image already exists.
4738
-                                        }
4736
+										if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4737
+											continue; // Skip if image already exists.
4738
+										}
4739 4739
                                         
4740
-                                        $image_name_parts = explode( '.', $image_name );
4741
-                                        array_pop( $image_name_parts );
4742
-                                        $proper_image_name = implode( '.', $image_name_parts );
4740
+										$image_name_parts = explode( '.', $image_name );
4741
+										array_pop( $image_name_parts );
4742
+										$proper_image_name = implode( '.', $image_name_parts );
4743 4743
                                         
4744
-                                        $arr_file_type = wp_check_filetype( $image_name );
4744
+										$arr_file_type = wp_check_filetype( $image_name );
4745 4745
                                         
4746
-                                        if ( !empty( $arr_file_type ) ) {
4747
-                                            $uploaded_file_type = $arr_file_type['type'];
4746
+										if ( !empty( $arr_file_type ) ) {
4747
+											$uploaded_file_type = $arr_file_type['type'];
4748 4748
                                             
4749
-                                            $attachment = array();
4750
-                                            $attachment['post_id'] = $saved_post_id;
4751
-                                            $attachment['title'] = $proper_image_name;
4752
-                                            $attachment['content'] = '';
4753
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4754
-                                            $attachment['mime_type'] = $uploaded_file_type;
4755
-                                            $attachment['menu_order'] = $order;
4756
-                                            $attachment['is_featured'] = 0;
4757
-
4758
-                                            $attachment_set = '';
4759
-                                            foreach ( $attachment as $key => $val ) {
4760
-                                                if ( $val != '' ) {
4761
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4762
-                                                }
4763
-                                            }
4764
-                                            $attachment_set = trim( $attachment_set, ", " );
4749
+											$attachment = array();
4750
+											$attachment['post_id'] = $saved_post_id;
4751
+											$attachment['title'] = $proper_image_name;
4752
+											$attachment['content'] = '';
4753
+											$attachment['file'] = $uploads_subdir . '/' . $image_name;
4754
+											$attachment['mime_type'] = $uploaded_file_type;
4755
+											$attachment['menu_order'] = $order;
4756
+											$attachment['is_featured'] = 0;
4757
+
4758
+											$attachment_set = '';
4759
+											foreach ( $attachment as $key => $val ) {
4760
+												if ( $val != '' ) {
4761
+													$attachment_set .= $key . " = '" . $val . "', ";
4762
+												}
4763
+											}
4764
+											$attachment_set = trim( $attachment_set, ", " );
4765 4765
                                                                                         
4766
-                                            // Add new attachment
4767
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4766
+											// Add new attachment
4767
+											$wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4768 4768
                                                                                         
4769
-                                            $order++;
4770
-                                        }
4771
-                                    }
4769
+											$order++;
4770
+										}
4771
+									}
4772 4772
 
4773
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4774
-                                    // Remove previous attachment
4775
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4773
+									$saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4774
+									// Remove previous attachment
4775
+									$wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4776 4776
                                     
4777
-                                    if ( !empty( $saved_post_images_arr ) ) {
4778
-                                        $menu_order = 1;
4777
+									if ( !empty( $saved_post_images_arr ) ) {
4778
+										$menu_order = 1;
4779 4779
                                         
4780
-                                        foreach ( $saved_post_images_arr as $img_name ) {
4781
-                                            $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 ) ) );
4780
+										foreach ( $saved_post_images_arr as $img_name ) {
4781
+											$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 ) ) );
4782 4782
                                             
4783
-                                            if( $menu_order == 1 ) {
4784
-                                                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 ) ) ) ) {
4785
-                                                    $wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
4786
-                                                }
4787
-                                            }
4788
-                                            $menu_order++;
4789
-                                        }
4790
-                                    }
4783
+											if( $menu_order == 1 ) {
4784
+												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 ) ) ) ) {
4785
+													$wpdb->query( $wpdb->prepare( "UPDATE " . $table . " SET featured_image = %s WHERE post_id =%d", array( $featured_image, $saved_post_id ) ) );
4786
+												}
4787
+											}
4788
+											$menu_order++;
4789
+										}
4790
+									}
4791 4791
                                     
4792
-                                    if ( $order > 1 ) {
4793
-                                        $images++;
4794
-                                    }
4795
-                                }
4792
+									if ( $order > 1 ) {
4793
+										$images++;
4794
+									}
4795
+								}
4796 4796
 
4797
-                                /** This action is documented in geodirectory-functions/post-functions.php */
4798
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4797
+								/** This action is documented in geodirectory-functions/post-functions.php */
4798
+								do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4799 4799
                                 
4800
-                                if (isset($is_featured)) {
4801
-                                    geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4802
-                                }
4803
-                                if (isset($gd_post['expire_date'])) {
4804
-                                    geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4805
-                                }
4806
-                            }
4800
+								if (isset($is_featured)) {
4801
+									geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4802
+								}
4803
+								if (isset($gd_post['expire_date'])) {
4804
+									geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4805
+								}
4806
+							}
4807 4807
                             
4808
-                            // WPML
4809
-                            if ($is_wpml && $language != '') {
4810
-                                $sitepress->switch_lang($active_lang, true);
4811
-                            }
4812
-                            // WPML
4813
-                        }
4814
-                    }
4815
-                }
4808
+							// WPML
4809
+							if ($is_wpml && $language != '') {
4810
+								$sitepress->switch_lang($active_lang, true);
4811
+							}
4812
+							// WPML
4813
+						}
4814
+					}
4815
+				}
4816 4816
 
4817
-                //undo some stuff to make the import quicker
4818
-                wp_defer_term_counting( false );
4819
-                wp_defer_comment_counting( false );
4820
-                $wpdb->query( 'COMMIT;' );
4821
-                $wpdb->query( 'SET autocommit = 1;' );
4822
-
4823
-                $json = array();
4824
-                $json['processed'] = $processed_actual;
4825
-                $json['created'] = $created;
4826
-                $json['updated'] = $updated;
4827
-                $json['skipped'] = $skipped;
4828
-                $json['invalid'] = $invalid;
4829
-                $json['invalid_addr'] = $invalid_addr;
4830
-                $json['images'] = $images;
4817
+				//undo some stuff to make the import quicker
4818
+				wp_defer_term_counting( false );
4819
+				wp_defer_comment_counting( false );
4820
+				$wpdb->query( 'COMMIT;' );
4821
+				$wpdb->query( 'SET autocommit = 1;' );
4822
+
4823
+				$json = array();
4824
+				$json['processed'] = $processed_actual;
4825
+				$json['created'] = $created;
4826
+				$json['updated'] = $updated;
4827
+				$json['skipped'] = $skipped;
4828
+				$json['invalid'] = $invalid;
4829
+				$json['invalid_addr'] = $invalid_addr;
4830
+				$json['images'] = $images;
4831 4831
                 
4832
-                wp_send_json( $json );
4833
-                exit;
4834
-            } else if ( $task == 'import_loc' ) {
4835
-                global $gd_post_types;
4836
-                $gd_post_types = $post_types;
4832
+				wp_send_json( $json );
4833
+				exit;
4834
+			} else if ( $task == 'import_loc' ) {
4835
+				global $gd_post_types;
4836
+				$gd_post_types = $post_types;
4837 4837
                 
4838
-                if (!empty($file)) {
4839
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4838
+				if (!empty($file)) {
4839
+					$columns = isset($file[0]) ? $file[0] : NULL;
4840 4840
                     
4841
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4842
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4843
-                        wp_send_json( $json );
4844
-                    }
4841
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4842
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4843
+						wp_send_json( $json );
4844
+					}
4845 4845
                     
4846
-                    for ($i = 1; $i <= $limit; $i++) {
4847
-                        $index = $processed + $i;
4846
+					for ($i = 1; $i <= $limit; $i++) {
4847
+						$index = $processed + $i;
4848 4848
                         
4849
-                        if (isset($file[$index])) {
4850
-                            $row = $file[$index];
4851
-                            $row = array_map( 'trim', $row );
4852
-                            $data = array();
4849
+						if (isset($file[$index])) {
4850
+							$row = $file[$index];
4851
+							$row = array_map( 'trim', $row );
4852
+							$data = array();
4853 4853
                             
4854
-                            foreach ($columns as $c => $column ) {
4855
-                                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'))) {
4856
-                                    $data[$column] = $row[$c];
4857
-                                }
4858
-                            }
4854
+							foreach ($columns as $c => $column ) {
4855
+								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'))) {
4856
+									$data[$column] = $row[$c];
4857
+								}
4858
+							}
4859 4859
 
4860
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4861
-                                $invalid++;
4862
-                                continue;
4863
-                            }
4860
+							if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4861
+								$invalid++;
4862
+								continue;
4863
+							}
4864 4864
                             
4865
-                            $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4865
+							$data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4866 4866
                             
4867
-                            if ( $import_choice == 'update' ) {
4868
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4869
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4870
-                                        $updated++;
4871
-                                    } else {
4872
-                                        $invalid++;
4873
-                                    }
4874
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4875
-                                    $data['location_id'] = (int)$location->location_id;
4867
+							if ( $import_choice == 'update' ) {
4868
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4869
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4870
+										$updated++;
4871
+									} else {
4872
+										$invalid++;
4873
+									}
4874
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4875
+									$data['location_id'] = (int)$location->location_id;
4876 4876
                                     
4877
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4878
-                                        $data['location_id'] = (int)$location->location_id;
4879
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4880
-                                        $data['location_id'] = (int)$location->location_id;
4881
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4882
-                                        $data['location_id'] = (int)$location->location_id;
4883
-                                    }
4877
+									if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4878
+										$data['location_id'] = (int)$location->location_id;
4879
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4880
+										$data['location_id'] = (int)$location->location_id;
4881
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4882
+										$data['location_id'] = (int)$location->location_id;
4883
+									}
4884 4884
                                     
4885
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4886
-                                        $updated++;
4887
-                                    } else {
4888
-                                        $invalid++;
4889
-                                    }
4890
-                                } else {
4891
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4892
-                                        $created++;
4893
-                                    } else {
4894
-                                        $invalid++;
4895
-                                    }
4896
-                                }
4897
-                            } elseif ( $import_choice == 'skip' ) {
4898
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4899
-                                    $skipped++;
4900
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4901
-                                    $skipped++;
4902
-                                } else {
4903
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4904
-                                        $created++;
4905
-                                    } else {
4906
-                                        $invalid++;
4907
-                                    }
4908
-                                }
4909
-                            } else {
4910
-                                $invalid++;
4911
-                            }
4912
-                        }
4913
-                    }
4914
-                }
4885
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4886
+										$updated++;
4887
+									} else {
4888
+										$invalid++;
4889
+									}
4890
+								} else {
4891
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4892
+										$created++;
4893
+									} else {
4894
+										$invalid++;
4895
+									}
4896
+								}
4897
+							} elseif ( $import_choice == 'skip' ) {
4898
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4899
+									$skipped++;
4900
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4901
+									$skipped++;
4902
+								} else {
4903
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4904
+										$created++;
4905
+									} else {
4906
+										$invalid++;
4907
+									}
4908
+								}
4909
+							} else {
4910
+								$invalid++;
4911
+							}
4912
+						}
4913
+					}
4914
+				}
4915 4915
                 
4916
-                $json = array();
4917
-                $json['processed'] = $limit;
4918
-                $json['created'] = $created;
4919
-                $json['updated'] = $updated;
4920
-                $json['skipped'] = $skipped;
4921
-                $json['invalid'] = $invalid;
4922
-                $json['images'] = $images;
4916
+				$json = array();
4917
+				$json['processed'] = $limit;
4918
+				$json['created'] = $created;
4919
+				$json['updated'] = $updated;
4920
+				$json['skipped'] = $skipped;
4921
+				$json['invalid'] = $invalid;
4922
+				$json['images'] = $images;
4923 4923
                 
4924
-                wp_send_json( $json );
4925
-            } else if ( $task == 'import_hood' ) {               
4926
-                if (!empty($file)) {
4927
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4924
+				wp_send_json( $json );
4925
+			} else if ( $task == 'import_hood' ) {               
4926
+				if (!empty($file)) {
4927
+					$columns = isset($file[0]) ? $file[0] : NULL;
4928 4928
                     
4929
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4930
-                        $json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4931
-                        wp_send_json( $json );
4932
-                    }
4929
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4930
+						$json['error'] = __('File you are uploading is not valid. Columns does not matching.', 'geodirectory');
4931
+						wp_send_json( $json );
4932
+					}
4933 4933
                     
4934
-                    for ($i = 1; $i <= $limit; $i++) {
4935
-                        $index = $processed + $i;
4934
+					for ($i = 1; $i <= $limit; $i++) {
4935
+						$index = $processed + $i;
4936 4936
                         
4937
-                        if (isset($file[$index])) {
4938
-                            $row = $file[$index];
4939
-                            $row = array_map( 'trim', $row );
4940
-                            $data = array();
4937
+						if (isset($file[$index])) {
4938
+							$row = $file[$index];
4939
+							$row = array_map( 'trim', $row );
4940
+							$data = array();
4941 4941
                             
4942
-                            foreach ($columns as $c => $column) {
4943
-                                if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
4944
-                                    $data[$column] = sanitize_text_field($row[$c]);
4945
-                                }
4946
-                            }
4942
+							foreach ($columns as $c => $column) {
4943
+								if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
4944
+									$data[$column] = sanitize_text_field($row[$c]);
4945
+								}
4946
+							}
4947 4947
 
4948
-                            if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4949
-                                $invalid++;
4950
-                                continue;
4951
-                            }
4948
+							if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4949
+								$invalid++;
4950
+								continue;
4951
+							}
4952 4952
                             
4953
-                            $location_info = array();
4954
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4955
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4956
-                            } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4957
-                                $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4958
-                            }
4953
+							$location_info = array();
4954
+							if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4955
+								$location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4956
+							} else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4957
+								$location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4958
+							}
4959 4959
 
4960
-                            if (empty($location_info)) {
4961
-                                $invalid++;
4962
-                                continue;
4963
-                            }
4960
+							if (empty($location_info)) {
4961
+								$invalid++;
4962
+								continue;
4963
+							}
4964 4964
                             
4965
-                            $location_id = $location_info->location_id;
4965
+							$location_id = $location_info->location_id;
4966 4966
 
4967
-                            $data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
4967
+							$data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
4968 4968
                             
4969
-                            $hood_data = array();
4970
-                            $hood_data['hood_name'] = $data['neighbourhood_name'];
4971
-                            $hood_data['hood_slug'] = $data['neighbourhood_slug'];
4972
-                            $hood_data['hood_latitude'] = $data['longitude'];
4973
-                            $hood_data['hood_longitude'] = $data['longitude'];
4974
-                            $hood_data['hood_location_id'] = $location_id;
4969
+							$hood_data = array();
4970
+							$hood_data['hood_name'] = $data['neighbourhood_name'];
4971
+							$hood_data['hood_slug'] = $data['neighbourhood_slug'];
4972
+							$hood_data['hood_latitude'] = $data['longitude'];
4973
+							$hood_data['hood_longitude'] = $data['longitude'];
4974
+							$hood_data['hood_location_id'] = $location_id;
4975 4975
                                     
4976
-                            if ( $import_choice == 'update' ) {
4977
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4978
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4976
+							if ( $import_choice == 'update' ) {
4977
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4978
+									$hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4979 4979
                                     
4980
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4981
-                                        $updated++;
4982
-                                    } else {
4983
-                                        $invalid++;
4984
-                                    }
4985
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4986
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4980
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4981
+										$updated++;
4982
+									} else {
4983
+										$invalid++;
4984
+									}
4985
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4986
+									$hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4987 4987
                                     
4988
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4989
-                                        $updated++;
4990
-                                    } else {
4991
-                                        $invalid++;
4992
-                                    }
4993
-                                } else {
4994
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4995
-                                        $created++;
4996
-                                    } else {
4997
-                                        $invalid++;
4998
-                                    }
4999
-                                }
5000
-                            } elseif ( $import_choice == 'skip' ) {
5001
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5002
-                                    $skipped++;
5003
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5004
-                                    $skipped++;
5005
-                                } else {
4988
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4989
+										$updated++;
4990
+									} else {
4991
+										$invalid++;
4992
+									}
4993
+								} else {
4994
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4995
+										$created++;
4996
+									} else {
4997
+										$invalid++;
4998
+									}
4999
+								}
5000
+							} elseif ( $import_choice == 'skip' ) {
5001
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
5002
+									$skipped++;
5003
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
5004
+									$skipped++;
5005
+								} else {
5006 5006
                                     
5007
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5008
-                                        $created++;
5009
-                                    } else {
5010
-                                        $invalid++;
5011
-                                    }
5012
-                                }
5013
-                            } else {
5014
-                                $invalid++;
5015
-                            }
5016
-                        }
5017
-                    }
5018
-                }
5007
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
5008
+										$created++;
5009
+									} else {
5010
+										$invalid++;
5011
+									}
5012
+								}
5013
+							} else {
5014
+								$invalid++;
5015
+							}
5016
+						}
5017
+					}
5018
+				}
5019 5019
                 
5020
-                $json = array();
5021
-                $json['processed'] = $limit;
5022
-                $json['created'] = $created;
5023
-                $json['updated'] = $updated;
5024
-                $json['skipped'] = $skipped;
5025
-                $json['invalid'] = $invalid;
5026
-                $json['images'] = $images;
5020
+				$json = array();
5021
+				$json['processed'] = $limit;
5022
+				$json['created'] = $created;
5023
+				$json['updated'] = $updated;
5024
+				$json['skipped'] = $skipped;
5025
+				$json['invalid'] = $invalid;
5026
+				$json['images'] = $images;
5027 5027
                 
5028
-                wp_send_json( $json );
5029
-            }
5030
-        }
5031
-        break;
5032
-        case 'import_finish':{
5033
-            /**
5034
-             * Run an action when an import finishes.
5035
-             *
5036
-             * This action can be used to fire functions after an import ends.
5037
-             *
5038
-             * @since 1.5.3
5039
-             * @package GeoDirectory
5040
-             */
5041
-            do_action('geodir_import_finished');
5042
-        }
5043
-        break;
5028
+				wp_send_json( $json );
5029
+			}
5030
+		}
5031
+		break;
5032
+		case 'import_finish':{
5033
+			/**
5034
+			 * Run an action when an import finishes.
5035
+			 *
5036
+			 * This action can be used to fire functions after an import ends.
5037
+			 *
5038
+			 * @since 1.5.3
5039
+			 * @package GeoDirectory
5040
+			 */
5041
+			do_action('geodir_import_finished');
5042
+		}
5043
+		break;
5044 5044
 
5045
-    }
5046
-    echo '0';
5047
-    wp_die();
5045
+	}
5046
+	echo '0';
5047
+	wp_die();
5048 5048
 }
5049 5049
 
5050 5050
 /**
@@ -5088,12 +5088,12 @@  discard block
 block discarded – undo
5088 5088
 		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
5089 5089
 	}
5090 5090
 	
5091
-    if( !empty( $term ) ) {
5091
+	if( !empty( $term ) ) {
5092 5092
 		$result = wp_insert_term( $term, $taxonomy, $args );
5093
-        if( !is_wp_error( $result ) ) {
5094
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5095
-        }
5096
-    }
5093
+		if( !is_wp_error( $result ) ) {
5094
+			return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5095
+		}
5096
+	}
5097 5097
 	
5098 5098
 	return false;
5099 5099
 }
@@ -5140,16 +5140,16 @@  discard block
 block discarded – undo
5140 5140
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5141 5141
 		
5142 5142
 		if( !is_wp_error( $result ) ) {
5143
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5144
-        }
5143
+			return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5144
+		}
5145 5145
 	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5146 5146
 		$term_data['term_id'] = $term_info['term_id'];
5147 5147
 		
5148 5148
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5149 5149
 		
5150 5150
 		if( !is_wp_error( $result ) ) {
5151
-            return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5152
-        }
5151
+			return $term_id = isset( $result['term_id'] ) ? $result['term_id'] : 0;
5152
+		}
5153 5153
 	} else {
5154 5154
 		return geodir_imex_insert_term( $taxonomy, $term_data );
5155 5155
 	}
@@ -5174,7 +5174,7 @@  discard block
 block discarded – undo
5174 5174
 	 * Modify returned post counts for the current post type.
5175 5175
 	 *
5176 5176
 	 * @since 1.4.6
5177
-     * @package GeoDirectory
5177
+	 * @package GeoDirectory
5178 5178
 	 *
5179 5179
 	 * @param int $posts_count Post counts.
5180 5180
 	 * @param string $post_type Post type.
@@ -5237,9 +5237,9 @@  discard block
 block discarded – undo
5237 5237
 	
5238 5238
 	if ( !empty( $posts ) ) {
5239 5239
 		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5240
-        $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5241
-        $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5242
-        $neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5240
+		$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5241
+		$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5242
+		$neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5243 5243
 		
5244 5244
 		$csv_row = array();
5245 5245
 		$csv_row[] = 'post_id';
@@ -5283,11 +5283,11 @@  discard block
 block discarded – undo
5283 5283
 		$csv_row[] = 'post_zip';
5284 5284
 		$csv_row[] = 'post_latitude';
5285 5285
 		$csv_row[] = 'post_longitude';
5286
-        if ($neighbourhood_active) {
5287
-            $csv_row[] = 'post_neighbourhood';
5288
-            $csv_row[] = 'neighbourhood_latitude';
5289
-            $csv_row[] = 'neighbourhood_longitude';
5290
-        }
5286
+		if ($neighbourhood_active) {
5287
+			$csv_row[] = 'post_neighbourhood';
5288
+			$csv_row[] = 'neighbourhood_latitude';
5289
+			$csv_row[] = 'neighbourhood_longitude';
5290
+		}
5291 5291
 		$csv_row[] = 'geodir_timing';
5292 5292
 		$csv_row[] = 'geodir_contact';
5293 5293
 		$csv_row[] = 'geodir_email';
@@ -5322,7 +5322,7 @@  discard block
 block discarded – undo
5322 5322
 		$csv_rows[] = $csv_row;
5323 5323
 
5324 5324
 		$images_count = 5;
5325
-        $xx=0;
5325
+		$xx=0;
5326 5326
 		foreach ( $posts as $post ) {$xx++;
5327 5327
 			$post_id = $post['ID'];
5328 5328
 			
@@ -5469,21 +5469,21 @@  discard block
 block discarded – undo
5469 5469
 			$csv_row[] = $post_info['post_zip']; // post_zip
5470 5470
 			$csv_row[] = $post_info['post_latitude']; // post_latitude
5471 5471
 			$csv_row[] = $post_info['post_longitude']; // post_longitude
5472
-            if ($neighbourhood_active) {
5473
-                $post_neighbourhood = '';
5474
-                $neighbourhood_latitude = '';
5475
-                $neighbourhood_longitude = '';
5476
-                if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5477
-                    if (!empty($hood_info)) {
5478
-                        $post_neighbourhood = $hood_info->hood_name;
5479
-                        $neighbourhood_latitude = $hood_info->hood_latitude;
5480
-                        $neighbourhood_longitude = $hood_info->hood_longitude;
5481
-                    }
5482
-                }
5483
-                $csv_row[] = $post_neighbourhood; // post_neighbourhood
5484
-                $csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5485
-                $csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5486
-            }
5472
+			if ($neighbourhood_active) {
5473
+				$post_neighbourhood = '';
5474
+				$neighbourhood_latitude = '';
5475
+				$neighbourhood_longitude = '';
5476
+				if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5477
+					if (!empty($hood_info)) {
5478
+						$post_neighbourhood = $hood_info->hood_name;
5479
+						$neighbourhood_latitude = $hood_info->hood_latitude;
5480
+						$neighbourhood_longitude = $hood_info->hood_longitude;
5481
+					}
5482
+				}
5483
+				$csv_row[] = $post_neighbourhood; // post_neighbourhood
5484
+				$csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5485
+				$csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5486
+			}
5487 5487
 			$csv_row[] = $post_info['geodir_timing']; // geodir_timing
5488 5488
 			$csv_row[] = $post_info['geodir_contact']; // geodir_contact
5489 5489
 			$csv_row[] = $post_info['geodir_email']; // geodir_email
@@ -5577,7 +5577,7 @@  discard block
 block discarded – undo
5577 5577
 	 * Modify returned posts SQL query for the current post type.
5578 5578
 	 *
5579 5579
 	 * @since 1.4.6
5580
-     * @package GeoDirectory
5580
+	 * @package GeoDirectory
5581 5581
 	 *
5582 5582
 	 * @param int $query The SQL query.
5583 5583
 	 * @param string $post_type Post type.
@@ -5590,7 +5590,7 @@  discard block
 block discarded – undo
5590 5590
 	 * Modify returned post results for the current post type.
5591 5591
 	 *
5592 5592
 	 * @since 1.4.6
5593
-     * @package GeoDirectory
5593
+	 * @package GeoDirectory
5594 5594
 	 *
5595 5595
 	 * @param object $results An object containing all post ids.
5596 5596
 	 * @param string $post_type Post type.
@@ -6315,43 +6315,43 @@  discard block
 block discarded – undo
6315 6315
  * @param string $status Post status.
6316 6316
  */
6317 6317
 function geodir_create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0, $status = 'publish') {
6318
-    global $wpdb, $current_user;
6319
-
6320
-    $option_value = get_option($option);
6321
-
6322
-    if ($option_value > 0) :
6323
-        if (get_post($option_value)) :
6324
-            // Page exists
6325
-            return;
6326
-        endif;
6327
-    endif;
6328
-
6329
-    $page_found = $wpdb->get_var(
6330
-        $wpdb->prepare(
6331
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6332
-            array($slug)
6333
-        )
6334
-    );
6335
-
6336
-    if ($page_found) :
6337
-        // Page exists
6338
-        if (!$option_value) update_option($option, $page_found);
6339
-        return;
6340
-    endif;
6341
-
6342
-    $page_data = array(
6343
-        'post_status' => $status,
6344
-        'post_type' => 'page',
6345
-        'post_author' => $current_user->ID,
6346
-        'post_name' => $slug,
6347
-        'post_title' => $page_title,
6348
-        'post_content' => $page_content,
6349
-        'post_parent' => $post_parent,
6350
-        'comment_status' => 'closed'
6351
-    );
6352
-    $page_id = wp_insert_post($page_data);
6353
-
6354
-    add_option($option, $page_id);
6318
+	global $wpdb, $current_user;
6319
+
6320
+	$option_value = get_option($option);
6321
+
6322
+	if ($option_value > 0) :
6323
+		if (get_post($option_value)) :
6324
+			// Page exists
6325
+			return;
6326
+		endif;
6327
+	endif;
6328
+
6329
+	$page_found = $wpdb->get_var(
6330
+		$wpdb->prepare(
6331
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6332
+			array($slug)
6333
+		)
6334
+	);
6335
+
6336
+	if ($page_found) :
6337
+		// Page exists
6338
+		if (!$option_value) update_option($option, $page_found);
6339
+		return;
6340
+	endif;
6341
+
6342
+	$page_data = array(
6343
+		'post_status' => $status,
6344
+		'post_type' => 'page',
6345
+		'post_author' => $current_user->ID,
6346
+		'post_name' => $slug,
6347
+		'post_title' => $page_title,
6348
+		'post_content' => $page_content,
6349
+		'post_parent' => $post_parent,
6350
+		'comment_status' => 'closed'
6351
+	);
6352
+	$page_id = wp_insert_post($page_data);
6353
+
6354
+	add_option($option, $page_id);
6355 6355
 
6356 6356
 }
6357 6357
 
@@ -6382,9 +6382,9 @@  discard block
 block discarded – undo
6382 6382
  * @package GeoDirectory
6383 6383
  */
6384 6384
 function geodir_admin_upgrade_notice() {
6385
-    $class = "error";
6386
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6387
-    echo"<div class=\"$class\"> <p>$message</p></div>";
6385
+	$class = "error";
6386
+	$message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6387
+	echo"<div class=\"$class\"> <p>$message</p></div>";
6388 6388
 }
6389 6389
 
6390 6390
 /**
@@ -6397,18 +6397,18 @@  discard block
 block discarded – undo
6397 6397
  */
6398 6398
 function geodire_admin_upgrade_notice( $plugin_data, $r )
6399 6399
 {
6400
-    // readme contents
6401
-    $args = array(
6402
-        'timeout'     => 15,
6403
-        'redirection' => 5
6404
-    );
6405
-    $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6406
-    $data       = wp_remote_get( $url, $args );
6400
+	// readme contents
6401
+	$args = array(
6402
+		'timeout'     => 15,
6403
+		'redirection' => 5
6404
+	);
6405
+	$url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6406
+	$data       = wp_remote_get( $url, $args );
6407 6407
 
6408
-    if (!is_wp_error($data) && $data['response']['code'] == 200) {
6408
+	if (!is_wp_error($data) && $data['response']['code'] == 200) {
6409 6409
 
6410
-        geodir_in_plugin_update_message($data['body']);
6411
-    }
6410
+		geodir_in_plugin_update_message($data['body']);
6411
+	}
6412 6412
 }
6413 6413
 
6414 6414
 
@@ -6416,28 +6416,28 @@  discard block
 block discarded – undo
6416 6416
 * @param string $body http response body
6417 6417
 */
6418 6418
 function geodir_in_plugin_update_message($content) {
6419
-    // Output Upgrade Notice
6420
-    $matches        = null;
6421
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6422
-    $upgrade_notice = '';
6423
-    if ( preg_match( $regexp, $content, $matches ) ) {
6424
-        if(empty($matches)){return;}
6425
-
6426
-        $version = trim( $matches[1] );
6427
-        if($version && $version>GEODIRECTORY_VERSION){
6428
-
6429
-
6430
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6431
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6432
-            $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6433
-            foreach ( $notices as $index => $line ) {
6434
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6435
-            }
6436
-            $upgrade_notice .= '</div> ';
6437
-        }
6438
-        }
6439
-    }
6440
-    echo $upgrade_notice;
6419
+	// Output Upgrade Notice
6420
+	$matches        = null;
6421
+	$regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6422
+	$upgrade_notice = '';
6423
+	if ( preg_match( $regexp, $content, $matches ) ) {
6424
+		if(empty($matches)){return;}
6425
+
6426
+		$version = trim( $matches[1] );
6427
+		if($version && $version>GEODIRECTORY_VERSION){
6428
+
6429
+
6430
+		$notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6431
+		if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6432
+			$upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6433
+			foreach ( $notices as $index => $line ) {
6434
+				$upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6435
+			}
6436
+			$upgrade_notice .= '</div> ';
6437
+		}
6438
+		}
6439
+	}
6440
+	echo $upgrade_notice;
6441 6441
 }
6442 6442
 
6443 6443
 /**
Please login to merge, or discard this patch.