Test Failed
Pull Request — master (#456)
by Kiran
16:45
created
geodirectory-functions/privacy/abstract-geodir-privacy.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package GeoDirectory
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Abstract class that is intended to be extended by specific privacy class. 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @param string $name Plugin identifier.
45 45
 	 */
46
-	public function __construct( $name = '' ) {
46
+	public function __construct($name = '') {
47 47
 		$this->name = $name;
48 48
 		$this->init();
49 49
 	}
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	 * Hook in events.
53 53
 	 */
54 54
 	protected function init() {
55
-		add_action( 'admin_init', array( $this, 'add_privacy_message' ) );
55
+		add_action('admin_init', array($this, 'add_privacy_message'));
56 56
 		// Register data exporters
57
-		add_filter( 'wp_privacy_personal_data_exporters', array( $this, 'register_exporters' ), 5 );
57
+		add_filter('wp_privacy_personal_data_exporters', array($this, 'register_exporters'), 5);
58 58
 		// Register data erasers
59
-		add_filter( 'wp_privacy_personal_data_erasers', array( $this, 'register_erasers' ) );
59
+		add_filter('wp_privacy_personal_data_erasers', array($this, 'register_erasers'));
60 60
 	}
61 61
 
62 62
 	/**
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 	public function add_privacy_message() {
66 66
 		$content = $this->get_privacy_message();
67 67
 
68
-		if ( $content ) {
69
-			wp_add_privacy_policy_content( $this->name, $this->get_privacy_message() );
68
+		if ($content) {
69
+			wp_add_privacy_policy_content($this->name, $this->get_privacy_message());
70 70
 		}
71 71
 	}
72 72
 
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	 * @param array $exporters List of exporter callbacks.
87 87
 	 * @return array
88 88
 	 */
89
-	public function register_exporters( $exporters = array() ) {
90
-		foreach ( $this->exporters as $id => $exporter ) {
91
-			$exporters[ $id ] = $exporter;
89
+	public function register_exporters($exporters = array()) {
90
+		foreach ($this->exporters as $id => $exporter) {
91
+			$exporters[$id] = $exporter;
92 92
 		}
93 93
 		return $exporters;
94 94
 	}
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * @param array $erasers List of eraser callbacks.
100 100
 	 * @return array
101 101
 	 */
102
-	public function register_erasers( $erasers = array() ) {
103
-		foreach ( $this->erasers as $id => $eraser ) {
104
-			$erasers[ $id ] = $eraser;
102
+	public function register_erasers($erasers = array()) {
103
+		foreach ($this->erasers as $id => $eraser) {
104
+			$erasers[$id] = $eraser;
105 105
 		}
106 106
 		return $erasers;
107 107
 	}
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	 * @param string $name     Exporter name.
114 114
 	 * @param string $callback Exporter callback.
115 115
 	 */
116
-	public function add_exporter( $id, $name, $callback ) {
117
-		$this->exporters[ $id ] = array(
116
+	public function add_exporter($id, $name, $callback) {
117
+		$this->exporters[$id] = array(
118 118
 			'exporter_friendly_name' => $name,
119 119
 			'callback'               => $callback,
120 120
 		);
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 * @param string $name     Exporter name.
129 129
 	 * @param string $callback Exporter callback.
130 130
 	 */
131
-	public function add_eraser( $id, $name, $callback ) {
132
-		$this->erasers[ $id ] = array(
131
+	public function add_eraser($id, $name, $callback) {
132
+		$this->erasers[$id] = array(
133 133
 			'eraser_friendly_name' => $name,
134 134
 			'callback'             => $callback,
135 135
 		);
Please login to merge, or discard this patch.
geodirectory-functions/privacy/class-geodir-privacy-background-process.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
  * @since   1.2.26
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11
-if ( ! class_exists( 'GeoDir_Background_Process', false ) ) {
12
-	include_once( 'class-geodir-background-process.php' );
11
+if (!class_exists('GeoDir_Background_Process', false)) {
12
+	include_once('class-geodir-background-process.php');
13 13
 }
14 14
 
15 15
 /**
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function __construct() {
24 24
 		// Uses unique prefix per blog so each blog has separate queue.
25
-		$this->prefix = 'wp_' . get_current_blog_id();
25
+		$this->prefix = 'wp_'.get_current_blog_id();
26 26
 		$this->action = 'geodir_privacy_cleanup';
27 27
 		parent::__construct();
28 28
 	}
@@ -33,24 +33,24 @@  discard block
 block discarded – undo
33 33
 	 * @param string $item Queue item to iterate over.
34 34
 	 * @return bool
35 35
 	 */
36
-	protected function task( $item ) {
37
-		if ( ! $item || empty( $item['task'] ) ) {
36
+	protected function task($item) {
37
+		if (!$item || empty($item['task'])) {
38 38
 			return false;
39 39
 		}
40 40
 
41 41
 		$process_count = 0;
42 42
 		$process_limit = 20;
43 43
 
44
-		switch ( $item['task'] ) {
44
+		switch ($item['task']) {
45 45
 			case 'trash_pending_posts':
46
-				$process_count = GeoDir_Privacy::trash_pending_posts( $process_limit );
46
+				$process_count = GeoDir_Privacy::trash_pending_posts($process_limit);
47 47
 				break;
48 48
 			case 'anonymize_published_posts':
49
-				$process_count = GeoDir_Privacy::anonymize_published_posts( $process_limit );
49
+				$process_count = GeoDir_Privacy::anonymize_published_posts($process_limit);
50 50
 				break;
51 51
 		}
52 52
 
53
-		if ( $process_limit === $process_count ) {
53
+		if ($process_limit === $process_count) {
54 54
 			return $item;
55 55
 		}
56 56
 
Please login to merge, or discard this patch.
geodirectory-functions/privacy/class-geodir-privacy-exporters.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -316,6 +316,10 @@
 block discarded – undo
316 316
 		return $personal_data;
317 317
 	}
318 318
 
319
+	/**
320
+	 * @param string $email_address
321
+	 * @param integer $page
322
+	 */
319 323
 	public static function posts_by_author( $email_address, $post_type, $page ) {
320 324
 		if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) {
321 325
 			return array();
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package GeoDirectory
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * GeoDir_Privacy_Exporters Class.
@@ -22,32 +22,32 @@  discard block
 block discarded – undo
22 22
 	 * @param int    $page  Page.
23 23
 	 * @return array An array of personal data in name value pairs
24 24
 	 */
25
-	public static function post_data_exporter( $email_address, $page ) {
26
-		$post_type 		= GeoDir_Privacy::exporter_post_type();
25
+	public static function post_data_exporter($email_address, $page) {
26
+		$post_type = GeoDir_Privacy::exporter_post_type();
27 27
 
28 28
 		$done           = false;
29 29
 		$page           = (int) $page;
30 30
 		$data_to_export = array();
31 31
 
32
-		$posts 			= self::posts_by_author( $email_address, $post_type, $page );
32
+		$posts = self::posts_by_author($email_address, $post_type, $page);
33 33
 
34
-		if ( 0 < count( $posts ) ) {
35
-			$obj_post_type = get_post_type_object( $post_type );
34
+		if (0 < count($posts)) {
35
+			$obj_post_type = get_post_type_object($post_type);
36 36
 
37
-			foreach ( $posts as $post_ID ) {
38
-				$gd_post = geodir_get_post_info( $post_ID );
39
-				if ( empty( $gd_post ) ) {
37
+			foreach ($posts as $post_ID) {
38
+				$gd_post = geodir_get_post_info($post_ID);
39
+				if (empty($gd_post)) {
40 40
 					continue;
41 41
 				}
42 42
 
43 43
 				$data_to_export[] = array(
44
-					'group_id'    => 'geodirectory-post-' . $post_type,
45
-					'group_label' => __( $obj_post_type->labels->name, 'geodirectory' ),
46
-					'item_id'     => 'post-' . $post_ID,
47
-					'data'        => self::get_post_personal_data( $gd_post ),
44
+					'group_id'    => 'geodirectory-post-'.$post_type,
45
+					'group_label' => __($obj_post_type->labels->name, 'geodirectory'),
46
+					'item_id'     => 'post-'.$post_ID,
47
+					'data'        => self::get_post_personal_data($gd_post),
48 48
 				);
49 49
 			}
50
-			$done = 10 > count( $posts );
50
+			$done = 10 > count($posts);
51 51
 		} else {
52 52
 			$done = true;
53 53
 		}
@@ -65,24 +65,24 @@  discard block
 block discarded – undo
65 65
 	 * @param WP_Post $gd_post The post object.
66 66
 	 * @return array
67 67
 	 */
68
-	protected static function get_post_personal_data( $gd_post ) {
68
+	protected static function get_post_personal_data($gd_post) {
69 69
 		$post_categories = array();
70 70
 		$post_tags = array();
71 71
 		$default_category = '';
72 72
 
73
-		$cat_taxonomy = $gd_post->post_type . 'category';
74
-		$tag_taxonomy = $gd_post->post_type . '_tags';
73
+		$cat_taxonomy = $gd_post->post_type.'category';
74
+		$tag_taxonomy = $gd_post->post_type.'_tags';
75 75
 
76
-		$post_terms = wp_get_post_terms( $gd_post->ID, array( $cat_taxonomy, $tag_taxonomy ) );
77
-		if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) {
78
-			foreach ( $post_terms as $term ) {
79
-				if ( $term->taxonomy == $cat_taxonomy ) {
76
+		$post_terms = wp_get_post_terms($gd_post->ID, array($cat_taxonomy, $tag_taxonomy));
77
+		if (!empty($post_terms) && !is_wp_error($post_terms)) {
78
+			foreach ($post_terms as $term) {
79
+				if ($term->taxonomy == $cat_taxonomy) {
80 80
 					$post_categories[] = $term->name;
81 81
 				} else {
82 82
 					$post_tags[] = $term->name;
83 83
 				}
84 84
 
85
-				if ( $gd_post->default_category == $term->term_id ) {
85
+				if ($gd_post->default_category == $term->term_id) {
86 86
 					$default_category = $term->name;
87 87
 				}
88 88
 			}
@@ -90,123 +90,123 @@  discard block
 block discarded – undo
90 90
 
91 91
 		$personal_data = array();
92 92
 		$personal_data[] = array(
93
-			'name'  => __( 'Post ID', 'geodirectory' ),
93
+			'name'  => __('Post ID', 'geodirectory'),
94 94
 			'value' => $gd_post->ID,
95 95
 		);
96 96
 		$personal_data[] = array(
97
-			'name'  => __( 'Post Title', 'geodirectory' ),
97
+			'name'  => __('Post Title', 'geodirectory'),
98 98
 			'value' => $gd_post->post_title,
99 99
 		);
100 100
 		$personal_data[] = array(
101
-			'name'  => __( 'Post Date', 'geodirectory' ),
101
+			'name'  => __('Post Date', 'geodirectory'),
102 102
 			'value' => $gd_post->post_date,
103 103
 		);
104 104
 		$personal_data[] = array(
105
-			'name'  => __( 'Post Status', 'geodirectory' ),
105
+			'name'  => __('Post Status', 'geodirectory'),
106 106
 			'value' => $gd_post->post_status,
107 107
 		);
108 108
 		$personal_data[] = array(
109
-			'name'  => __( 'Post Categories', 'geodirectory' ),
110
-			'value' => ( ! empty( $post_categories ) ? implode( ', ', $post_categories ) : '' ),
109
+			'name'  => __('Post Categories', 'geodirectory'),
110
+			'value' => (!empty($post_categories) ? implode(', ', $post_categories) : ''),
111 111
 		);
112
-		if ( $default_category ) {
112
+		if ($default_category) {
113 113
 			$personal_data[] = array(
114
-				'name'  => __( 'Default Category', 'geodirectory' ),
114
+				'name'  => __('Default Category', 'geodirectory'),
115 115
 				'value' => $default_category,
116 116
 			);
117 117
 		}
118
-		if ( ! empty( $post_tags ) ) {
118
+		if (!empty($post_tags)) {
119 119
 			$personal_data[] = array(
120
-				'name'  => __( 'Post Tags', 'geodirectory' ),
121
-				'value' => implode( ', ', $post_tags ),
120
+				'name'  => __('Post Tags', 'geodirectory'),
121
+				'value' => implode(', ', $post_tags),
122 122
 			);
123 123
 		}
124 124
 		$personal_data[] = array(
125
-			'name'  => __( 'Post URL', 'geodirectory' ),
126
-			'value' => get_permalink( $gd_post->ID ),
125
+			'name'  => __('Post URL', 'geodirectory'),
126
+			'value' => get_permalink($gd_post->ID),
127 127
 		);
128 128
 
129
-		$custom_fields 	= geodir_post_custom_fields( $gd_post->package_id, 'all', $gd_post->post_type );
130
-		$post_fields 	= array_keys( (array) $gd_post );
129
+		$custom_fields = geodir_post_custom_fields($gd_post->package_id, 'all', $gd_post->post_type);
130
+		$post_fields = array_keys((array) $gd_post);
131 131
 
132
-		foreach ( $custom_fields as $key => $field ) {
133
-			$field_name 			= ! empty( $field['htmlvar_name'] ) ? $field['htmlvar_name'] : '';
134
-			if ( empty( $field_name ) ) {
132
+		foreach ($custom_fields as $key => $field) {
133
+			$field_name = !empty($field['htmlvar_name']) ? $field['htmlvar_name'] : '';
134
+			if (empty($field_name)) {
135 135
 				continue;
136 136
 			}
137 137
 
138
-			$field 					= stripslashes_deep( $field );
138
+			$field = stripslashes_deep($field);
139 139
 
140
-			$extra_fields 			= ! empty( $field['extra_fields'] ) ? $field['extra_fields'] : array();
140
+			$extra_fields = !empty($field['extra_fields']) ? $field['extra_fields'] : array();
141 141
 			$data_type              = $field['data_type'];
142 142
 			$field_type             = $field['field_type'];
143
-			$field_title			= $field['site_title'];
144
-			if ( $field_name == 'post' ) {
143
+			$field_title = $field['site_title'];
144
+			if ($field_name == 'post') {
145 145
 				$field_name = 'post_address';
146 146
 			}
147 147
 
148
-			if ( ! in_array( $field_name, $post_fields ) ) {
148
+			if (!in_array($field_name, $post_fields)) {
149 149
 				continue;
150 150
 			}
151 151
 
152 152
 			$name = $field_title;
153 153
 			$value = '';
154
-			switch ( $field_type ) {
154
+			switch ($field_type) {
155 155
 				case 'address':
156
-					$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $gd_post->post_type ) ? false : true;
157
-					if ( $location_allowed && ! empty( $gd_post->post_country ) && ! empty( $gd_post->post_region ) && ! empty( $gd_post->post_city ) ) {
156
+					$location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($gd_post->post_type) ? false : true;
157
+					if ($location_allowed && !empty($gd_post->post_country) && !empty($gd_post->post_region) && !empty($gd_post->post_city)) {
158 158
 						$personal_data[] = array(
159
-							'name'  => __( 'Post Address', 'geodirectory' ),
159
+							'name'  => __('Post Address', 'geodirectory'),
160 160
 							'value' => $gd_post->post_address,
161 161
 						);
162 162
 						$personal_data[] = array(
163
-							'name'  => __( 'Post City', 'geodirectory' ),
163
+							'name'  => __('Post City', 'geodirectory'),
164 164
 							'value' => $gd_post->post_city,
165 165
 						);
166 166
 						$personal_data[] = array(
167
-							'name'  => __( 'Post Region', 'geodirectory' ),
167
+							'name'  => __('Post Region', 'geodirectory'),
168 168
 							'value' => $gd_post->post_region,
169 169
 						);
170 170
 						$personal_data[] = array(
171
-							'name'  => __( 'Post Country', 'geodirectory' ),
171
+							'name'  => __('Post Country', 'geodirectory'),
172 172
 							'value' => $gd_post->post_country,
173 173
 						);
174 174
 						$personal_data[] = array(
175
-							'name'  => __( 'Post Zip', 'geodirectory' ),
175
+							'name'  => __('Post Zip', 'geodirectory'),
176 176
 							'value' => $gd_post->post_zip,
177 177
 						);
178 178
 						$personal_data[] = array(
179
-							'name'  => __( 'Post Latitude', 'geodirectory' ),
179
+							'name'  => __('Post Latitude', 'geodirectory'),
180 180
 							'value' => $gd_post->post_latitude,
181 181
 						);
182 182
 						$personal_data[] = array(
183
-							'name'  => __( 'Post Longitude', 'geodirectory' ),
183
+							'name'  => __('Post Longitude', 'geodirectory'),
184 184
 							'value' => $gd_post->post_longitude,
185 185
 						);
186 186
 					}
187 187
 				break;
188 188
 				case 'checkbox':
189
-					if ( ! empty( $gd_post->{$field_name} ) ) {
190
-						$value = __( 'Yes', 'geodirectory' );
189
+					if (!empty($gd_post->{$field_name} )) {
190
+						$value = __('Yes', 'geodirectory');
191 191
 					} else {
192
-						$value = __( 'No', 'geodirectory' );
192
+						$value = __('No', 'geodirectory');
193 193
 					}
194 194
 					break;
195 195
 				case 'datepicker':
196 196
 					$value = $gd_post->{$field_name} != '0000-00-00' ? $gd_post->{$field_name} : '';
197 197
 					break;
198 198
 				case 'radio':
199
-					if ( $gd_post->{$field_name} !== '' ) {
200
-						if ( $gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') {
201
-							$value = __( 'No', 'geodirectory' );
202
-						} else if ( $gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') {
203
-							$value = __( 'Yes', 'geodirectory' );
199
+					if ($gd_post->{$field_name} !== '') {
200
+						if ($gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') {
201
+							$value = __('No', 'geodirectory');
202
+						} else if ($gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') {
203
+							$value = __('Yes', 'geodirectory');
204 204
 						} else {
205
-							if ( !empty( $field['option_values'] ) ) {
206
-								$cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true );
207
-								if ( ! empty( $cf_option_values ) ) {
208
-									foreach ( $cf_option_values as $cf_option_value ) {
209
-										if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) {
205
+							if (!empty($field['option_values'])) {
206
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true);
207
+								if (!empty($cf_option_values)) {
208
+									foreach ($cf_option_values as $cf_option_value) {
209
+										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) {
210 210
 											$value = $cf_option_value['label'];
211 211
 										}
212 212
 									}
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
 					}
217 217
 					break;
218 218
 				case 'select':
219
-					$value = __( $gd_post->{$field_name}, 'geodirectory');
220
-					if ( !empty( $field['option_values'] ) ) {
221
-						$cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true );
222
-						if ( ! empty( $cf_option_values ) ) {
223
-							foreach ( $cf_option_values as $cf_option_value ) {
224
-								if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) {
219
+					$value = __($gd_post->{$field_name}, 'geodirectory');
220
+					if (!empty($field['option_values'])) {
221
+						$cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true);
222
+						if (!empty($cf_option_values)) {
223
+							foreach ($cf_option_values as $cf_option_value) {
224
+								if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) {
225 225
 									$value = $cf_option_value['label'];
226 226
 								}
227 227
 							}
@@ -229,23 +229,23 @@  discard block
 block discarded – undo
229 229
 					}
230 230
 					break;
231 231
 				case 'multiselect':
232
-					$field_values = explode( ',', trim( $gd_post->{$field_name}, "," ) );
233
-					if ( is_array( $field_values ) ) {
234
-						$field_values = array_map( 'trim', $field_values );
232
+					$field_values = explode(',', trim($gd_post->{$field_name}, ","));
233
+					if (is_array($field_values)) {
234
+						$field_values = array_map('trim', $field_values);
235 235
 					}
236 236
 					$values = array();
237
-					if ( ! empty( $field['option_values'] ) ) {
238
-						$cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true );
237
+					if (!empty($field['option_values'])) {
238
+						$cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true);
239 239
 
240
-						if ( ! empty( $cf_option_values ) ) {
241
-							foreach ( $cf_option_values as $cf_option_value ) {
242
-								if ( isset( $cf_option_value['value'] ) && in_array( $cf_option_value['value'], $field_values ) ) {
240
+						if (!empty($cf_option_values)) {
241
+							foreach ($cf_option_values as $cf_option_value) {
242
+								if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
243 243
 									$values[] = $cf_option_value['label'];
244 244
 								}
245 245
 							}
246 246
 						}
247 247
 					}
248
-					$value = ! empty( $values ) ? implode( ', ', $values ) : '';
248
+					$value = !empty($values) ? implode(', ', $values) : '';
249 249
 					break;
250 250
 				case 'time':
251 251
 					$value = $gd_post->{$field_name} != '00:00:00' ? $gd_post->{$field_name} : '';
@@ -256,49 +256,49 @@  discard block
 block discarded – undo
256 256
 				case 'url':
257 257
 				case 'html':
258 258
 				case 'textarea':
259
-					$value = $gd_post->{$field_name} ? strip_tags( $gd_post->{$field_name} ) : '';
259
+					$value = $gd_post->{$field_name} ? strip_tags($gd_post->{$field_name} ) : '';
260 260
 					break;
261 261
 				case 'file':
262
-					$files = explode( ",", $gd_post->{$field_name} );
263
-					if ( ! empty( $files ) ) {
264
-						$allowed_file_types = !empty( $extra_fields['gd_file_types'] ) && is_array( $extra_fields['gd_file_types'] ) && !in_array( "*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
262
+					$files = explode(",", $gd_post->{$field_name} );
263
+					if (!empty($files)) {
264
+						$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : '';
265 265
 
266 266
 						$file_urls = array();
267
-						foreach ( $files as $file ) {
268
-							if ( ! empty( $file ) ) {
269
-								$image_name_arr = explode( '/', $file );
270
-								$curr_img_dir = $image_name_arr[ count( $image_name_arr ) - 2];
267
+						foreach ($files as $file) {
268
+							if (!empty($file)) {
269
+								$image_name_arr = explode('/', $file);
270
+								$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
271 271
 								$filename = end($image_name_arr);
272 272
 								$img_name_arr = explode('.', $filename);
273 273
 
274
-								$arr_file_type = wp_check_filetype( $filename );
275
-								if ( empty( $arr_file_type['ext'] ) || empty( $arr_file_type['type'] ) ) {
274
+								$arr_file_type = wp_check_filetype($filename);
275
+								if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
276 276
 									continue;
277 277
 								}
278 278
 
279 279
 								$uploaded_file_type = $arr_file_type['type'];
280 280
 								$uploaded_file_ext = $arr_file_type['ext'];
281 281
 
282
-								if ( ! empty( $allowed_file_types ) && !in_array( $uploaded_file_ext, $allowed_file_types ) ) {
282
+								if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
283 283
 									continue; // Invalid file type.
284 284
 								}
285
-								$image_file_types = array( 'image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon' );
286
-								$audio_file_types = array( 'audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid' );
285
+								$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
286
+								$audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid');
287 287
 
288 288
 								// If the uploaded file is image
289
-								if ( in_array( $uploaded_file_type, $image_file_types ) ) {
289
+								if (in_array($uploaded_file_type, $image_file_types)) {
290 290
 									$file_urls[] = $file;
291 291
 								}
292 292
 							}
293 293
 						}
294
-						$value = ! empty( $file_urls ) ? implode( ', ', $file_urls ) : '';
294
+						$value = !empty($file_urls) ? implode(', ', $file_urls) : '';
295 295
 					}
296 296
 					break;
297 297
 			}
298 298
 
299
-			if ( ! empty( $name ) && $value !== '' ) {
299
+			if (!empty($name) && $value !== '') {
300 300
 				$personal_data[] = array(
301
-					'name'  => __( $name, 'geodirectory' ),
301
+					'name'  => __($name, 'geodirectory'),
302 302
 					'value' => $value,
303 303
 				);
304 304
 			}
@@ -311,28 +311,28 @@  discard block
 block discarded – undo
311 311
 		 * @param array    $personal_data Array of name value pairs to expose in the export.
312 312
 		 * @param WP_Post $gd_post The post object.
313 313
 		 */
314
-		$personal_data = apply_filters( 'geodir_privacy_export_post_personal_data', $personal_data, $gd_post );
314
+		$personal_data = apply_filters('geodir_privacy_export_post_personal_data', $personal_data, $gd_post);
315 315
 
316 316
 		return $personal_data;
317 317
 	}
318 318
 
319
-	public static function posts_by_author( $email_address, $post_type, $page ) {
320
-		if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) {
319
+	public static function posts_by_author($email_address, $post_type, $page) {
320
+		if (empty($email_address) || empty($post_type) || empty($page)) {
321 321
 			return array();
322 322
 		}
323 323
 
324
-		$user = get_user_by( 'email', $email_address );
325
-		if ( empty( $user ) ) {
324
+		$user = get_user_by('email', $email_address);
325
+		if (empty($user)) {
326 326
 			return array();
327 327
 		}
328 328
 
329
-		$statuses = array_keys( get_post_statuses() );
329
+		$statuses = array_keys(get_post_statuses());
330 330
 		$skip_statuses = geodir_imex_export_skip_statuses();
331
-		if ( ! empty( $skip_statuses ) ) {
332
-			$statuses = array_diff( $statuses, $skip_statuses );
331
+		if (!empty($skip_statuses)) {
332
+			$statuses = array_diff($statuses, $skip_statuses);
333 333
 		}
334 334
 
335
-		$query_args    = array(
335
+		$query_args = array(
336 336
 			'post_type'			=> $post_type,
337 337
 			'post_status'		=> $statuses,
338 338
 			'fields'			=> 'ids',
@@ -343,55 +343,55 @@  discard block
 block discarded – undo
343 343
 			'order'	   			=> 'ASC'
344 344
 		);
345 345
 
346
-		$query_args = apply_filters( 'geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page );
346
+		$query_args = apply_filters('geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page);
347 347
 
348
-		$posts = get_posts( $query_args );
348
+		$posts = get_posts($query_args);
349 349
 
350
-		return apply_filters( 'geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page );
350
+		return apply_filters('geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page);
351 351
 	}
352 352
 
353
-	public static function review_data_exporter( $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key ) {
353
+	public static function review_data_exporter($response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key) {
354 354
 		$exporter_key = GeoDir_Privacy::personal_data_exporter_key();
355 355
 
356
-		if ( $exporter_key == 'wordpress-comments' && ! empty( $response['data'] ) ) {
357
-			foreach ( $response['data'] as $key => $data ) {
358
-				$comment_id = str_replace( 'comment-', '', $data['item_id'] );
356
+		if ($exporter_key == 'wordpress-comments' && !empty($response['data'])) {
357
+			foreach ($response['data'] as $key => $data) {
358
+				$comment_id = str_replace('comment-', '', $data['item_id']);
359 359
 
360
-				$review = geodir_get_review( $comment_id );
361
-				if ( ! empty( $review ) ) {
362
-					if ( ! empty( $review->overall_rating ) ) {
363
-						$response['data'][ $key ]['data'][] = array(
364
-							'name'  => __( 'Review Rating', 'geodirectory' ),
365
-							'value' => (float)$review->overall_rating,
360
+				$review = geodir_get_review($comment_id);
361
+				if (!empty($review)) {
362
+					if (!empty($review->overall_rating)) {
363
+						$response['data'][$key]['data'][] = array(
364
+							'name'  => __('Review Rating', 'geodirectory'),
365
+							'value' => (float) $review->overall_rating,
366 366
 						);
367 367
 					}
368
-					if ( ! empty( $review->post_city ) ) {
369
-						$response['data'][ $key ]['data'][] = array(
370
-							'name'  => __( 'Review City', 'geodirectory' ),
368
+					if (!empty($review->post_city)) {
369
+						$response['data'][$key]['data'][] = array(
370
+							'name'  => __('Review City', 'geodirectory'),
371 371
 							'value' => $review->post_city,
372 372
 						);
373 373
 					}
374
-					if ( ! empty( $review->post_region ) ) {
375
-						$response['data'][ $key ]['data'][] = array(
376
-							'name'  => __( 'Review Region', 'geodirectory' ),
374
+					if (!empty($review->post_region)) {
375
+						$response['data'][$key]['data'][] = array(
376
+							'name'  => __('Review Region', 'geodirectory'),
377 377
 							'value' => $review->post_region,
378 378
 						);
379 379
 					}
380
-					if ( ! empty( $review->post_country ) ) {
381
-						$response['data'][ $key ]['data'][] = array(
382
-							'name'  => __( 'Review Country', 'geodirectory' ),
380
+					if (!empty($review->post_country)) {
381
+						$response['data'][$key]['data'][] = array(
382
+							'name'  => __('Review Country', 'geodirectory'),
383 383
 							'value' => $review->post_country,
384 384
 						);
385 385
 					}
386
-					if ( ! empty( $review->post_latitude ) ) {
387
-						$response['data'][ $key ]['data'][] = array(
388
-							'name'  => __( 'Review Latitude', 'geodirectory' ),
386
+					if (!empty($review->post_latitude)) {
387
+						$response['data'][$key]['data'][] = array(
388
+							'name'  => __('Review Latitude', 'geodirectory'),
389 389
 							'value' => $review->post_latitude,
390 390
 						);
391 391
 					}
392
-					if ( ! empty( $review->post_longitude ) ) {
393
-						$response['data'][ $key ]['data'][] = array(
394
-							'name'  => __( 'Review Longitude', 'geodirectory' ),
392
+					if (!empty($review->post_longitude)) {
393
+						$response['data'][$key]['data'][] = array(
394
+							'name'  => __('Review Longitude', 'geodirectory'),
395 395
 							'value' => $review->post_longitude,
396 396
 						);
397 397
 					}
Please login to merge, or discard this patch.
geodirectory-functions/privacy/class-geodir-privacy.php 1 patch
Spacing   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package GeoDirectory
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * GeoDir_Privacy Class.
@@ -24,41 +24,41 @@  discard block
 block discarded – undo
24 24
 	 * Init - hook into events.
25 25
 	 */
26 26
 	public function __construct() {
27
-		parent::__construct( __( 'GeoDirectory', 'geodirectory' ) );
27
+		parent::__construct(__('GeoDirectory', 'geodirectory'));
28 28
 
29
-		if ( ! self::$background_process ) {
29
+		if (!self::$background_process) {
30 30
 			self::$background_process = new GeoDir_Privacy_Background_Process();
31 31
 		}
32 32
 
33 33
 		// Include supporting classes.
34
-		include_once( 'class-geodir-privacy-erasers.php' );
35
-		include_once( 'class-geodir-privacy-exporters.php' );
34
+		include_once('class-geodir-privacy-erasers.php');
35
+		include_once('class-geodir-privacy-exporters.php');
36 36
 
37
-		$gd_post_types = geodir_get_posttypes( 'object' );
37
+		$gd_post_types = geodir_get_posttypes('object');
38 38
 
39
-		if ( ! empty( $gd_post_types ) ) {
40
-			foreach ( $gd_post_types as $post_type => $info ) {
39
+		if (!empty($gd_post_types)) {
40
+			foreach ($gd_post_types as $post_type => $info) {
41 41
 				$name = $info->labels->name;
42 42
 
43 43
 				// This hook registers GeoDirectory data exporters.
44
-				$this->add_exporter( 'geodirectory-post-' . $post_type, wp_sprintf( __( 'User %s', 'geodirectory' ), $name ), array( 'GeoDir_Privacy_Exporters', 'post_data_exporter' ) );
44
+				$this->add_exporter('geodirectory-post-'.$post_type, wp_sprintf(__('User %s', 'geodirectory'), $name), array('GeoDir_Privacy_Exporters', 'post_data_exporter'));
45 45
 
46 46
 				// This hook registers GeoDirectory data erasers.
47
-				$this->add_eraser( 'geodirectory-post-' . $post_type, wp_sprintf( __( 'User %s', 'geodirectory' ), $name ), array( 'GeoDir_Privacy_Erasers', 'post_data_eraser' ) );
47
+				$this->add_eraser('geodirectory-post-'.$post_type, wp_sprintf(__('User %s', 'geodirectory'), $name), array('GeoDir_Privacy_Erasers', 'post_data_eraser'));
48 48
 			}
49 49
 		}
50 50
 
51 51
 		// Cleanup orders daily - this is a callback on a daily cron event.
52
-		add_action( 'geodir_cleanup_personal_data', array( $this, 'queue_cleanup_personal_data' ) );
52
+		add_action('geodir_cleanup_personal_data', array($this, 'queue_cleanup_personal_data'));
53 53
 
54 54
 		// Handles custom anonomization types not included in core.
55
-		add_filter( 'wp_privacy_anonymize_data', array( $this, 'anonymize_custom_data_types' ), 10, 3 );
55
+		add_filter('wp_privacy_anonymize_data', array($this, 'anonymize_custom_data_types'), 10, 3);
56 56
 
57 57
 		// When this is fired, data is removed in a given order. Called from bulk actions.
58
-		add_action( 'geodir_remove_post_personal_data', array( 'GeoDir_Privacy_Erasers', 'remove_post_personal_data' ) );
58
+		add_action('geodir_remove_post_personal_data', array('GeoDir_Privacy_Erasers', 'remove_post_personal_data'));
59 59
 
60 60
 		// Review data
61
-		add_filter( 'wp_privacy_personal_data_export_page', array( 'GeoDir_Privacy_Exporters', 'review_data_exporter' ), 10, 7 );
61
+		add_filter('wp_privacy_personal_data_export_page', array('GeoDir_Privacy_Exporters', 'review_data_exporter'), 10, 7);
62 62
 	}
63 63
 
64 64
 	/**
@@ -75,97 +75,97 @@  discard block
 block discarded – undo
75 75
 		$content .=
76 76
 			'<div class="geodir-privacy-text">';
77 77
 		$content .=
78
-			'<h2>' . __( 'Who we are' ) . '</h2>';
78
+			'<h2>'.__('Who we are').'</h2>';
79 79
 		$content .=
80
-			'<p>' . __( 'GeoDirectory is the only WordPress directory plugin on the market that can scale to millions of listings and withstand the battering of traffic that comes along with that.' ) . '</p>';
80
+			'<p>'.__('GeoDirectory is the only WordPress directory plugin on the market that can scale to millions of listings and withstand the battering of traffic that comes along with that.').'</p>';
81 81
 
82
-			'<h2>' . __( 'What personal data we collect and why we collect it' ) . '</h2>';
82
+			'<h2>'.__('What personal data we collect and why we collect it').'</h2>';
83 83
 		$content .=
84
-			'<p>' . __( 'In this section you should note what personal data you collect from users and site visitors. This may include personal data, such as name, email address, personal account preferences; transactional data, such as purchase information; and technical data, such as information about cookies.' ) . '</p>' .
85
-			'<p>' . __( 'You should also note any collection and retention of sensitive personal data, such as data concerning health.' ) . '</p>' .
86
-			'<p>' . __( 'In addition to listing what personal data you collect, you need to note why you collect it. These explanations must note either the legal basis for your data collection and retention or the active consent the user has given.' ) . '</p>' .
87
-			'<p>' . __( 'Personal data is not just created by a user&#8217;s interactions with your site. Personal data is also generated from technical processes such as contact forms, comments, cookies, analytics, and third party embeds.' ) . '</p>' .
88
-			'<p>' . __( 'By default WordPress does not collect any personal data about visitors, and only collects the data shown on the User Profile screen from registered users. However some of your plugins may collect personal data. You should add the relevant information below.' ) . '</p>';
84
+			'<p>'.__('In this section you should note what personal data you collect from users and site visitors. This may include personal data, such as name, email address, personal account preferences; transactional data, such as purchase information; and technical data, such as information about cookies.').'</p>'.
85
+			'<p>'.__('You should also note any collection and retention of sensitive personal data, such as data concerning health.').'</p>'.
86
+			'<p>'.__('In addition to listing what personal data you collect, you need to note why you collect it. These explanations must note either the legal basis for your data collection and retention or the active consent the user has given.').'</p>'.
87
+			'<p>'.__('Personal data is not just created by a user&#8217;s interactions with your site. Personal data is also generated from technical processes such as contact forms, comments, cookies, analytics, and third party embeds.').'</p>'.
88
+			'<p>'.__('By default WordPress does not collect any personal data about visitors, and only collects the data shown on the User Profile screen from registered users. However some of your plugins may collect personal data. You should add the relevant information below.').'</p>';
89 89
 
90 90
 		$content .=
91
-			'<h3>' . __( 'Posts' ) . '</h3>';
91
+			'<h3>'.__('Posts').'</h3>';
92 92
 		$content .=
93
-			'<p>' . __( 'In this subsection you should note what information is captured through posts. We have noted the data which WordPress collects by default.' ) . '</p>' . 
94
-			'<p>' . __( 'When users add posts on the site we collect the data shown in the posts form, and also the visitor&#8217;s IP address and browser user agent string to help spam detection.' ) . '</p>' .
95
-			'<p>' . __( 'An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your post, your profile picture is visible to the public in the context of your post.' ) . '</p>';
93
+			'<p>'.__('In this subsection you should note what information is captured through posts. We have noted the data which WordPress collects by default.').'</p>'. 
94
+			'<p>'.__('When users add posts on the site we collect the data shown in the posts form, and also the visitor&#8217;s IP address and browser user agent string to help spam detection.').'</p>'.
95
+			'<p>'.__('An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your post, your profile picture is visible to the public in the context of your post.').'</p>';
96 96
 
97 97
 		$content .=
98
-			'<h3>' . __( 'Reviews' ) . '</h3>';
98
+			'<h3>'.__('Reviews').'</h3>';
99 99
 		$content .=
100
-			'<p>' . __( 'In this subsection you should note what information is captured through reviews. We have noted the data which WordPress collects by default.' ) . '</p>' . 
101
-			'<p>' . __( 'When visitors leave reviews on the site we collect the data shown in the reviews form, and also the visitor&#8217;s IP address and browser user agent string to help spam detection.' ) . '</p>' .
102
-			'<p>' . __( 'An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your review, your profile picture is visible to the public in the context of your review.' ) . '</p>';
100
+			'<p>'.__('In this subsection you should note what information is captured through reviews. We have noted the data which WordPress collects by default.').'</p>'. 
101
+			'<p>'.__('When visitors leave reviews on the site we collect the data shown in the reviews form, and also the visitor&#8217;s IP address and browser user agent string to help spam detection.').'</p>'.
102
+			'<p>'.__('An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your review, your profile picture is visible to the public in the context of your review.').'</p>';
103 103
 
104 104
 		$content .=
105
-			'<h3>' . __( 'Media' ) . '</h3>';
105
+			'<h3>'.__('Media').'</h3>';
106 106
 		$content .=
107
-			'<p>' . __( 'In this subsection you should note what information may be disclosed by users who can upload media files. All uploaded files are usually publicly accessible.' ) . '</p>' . 
108
-			'<p>' . __( 'If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.' ) . '</p>';
107
+			'<p>'.__('In this subsection you should note what information may be disclosed by users who can upload media files. All uploaded files are usually publicly accessible.').'</p>'. 
108
+			'<p>'.__('If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.').'</p>';
109 109
 
110 110
 		$content .=
111
-			'<h2>' . __( 'How long we retain your data' ) . '</h2>';
111
+			'<h2>'.__('How long we retain your data').'</h2>';
112 112
 		$content .=
113
-			'<p>' . __( 'In this section you should explain how long you retain personal data collected or processed by the web site. While it is your responsibility to come up with the schedule of how long you keep each dataset for and why you keep it, that information does need to be listed here. For example, you may want to say that you keep contact form entries for six months, analytics records for a year, and customer purchase records for ten years.' ) . '</p>' . 
114
-			'<p>' . __( 'If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.' ) . '</p>' .
115
-			'<p>' . __( 'For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.' ) . '</p>' .
113
+			'<p>'.__('In this section you should explain how long you retain personal data collected or processed by the web site. While it is your responsibility to come up with the schedule of how long you keep each dataset for and why you keep it, that information does need to be listed here. For example, you may want to say that you keep contact form entries for six months, analytics records for a year, and customer purchase records for ten years.').'</p>'. 
114
+			'<p>'.__('If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.').'</p>'.
115
+			'<p>'.__('For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.').'</p>'.
116 116
 
117
-			'<h2>' . __( 'What rights you have over your data' ) . '</h2>';
117
+			'<h2>'.__('What rights you have over your data').'</h2>';
118 118
 		$content .=
119
-			'<p>' . __( 'In this section you should explain what rights your users have over their data and how they can invoke those rights.' ) . '</p>' . 
120
-			'<p>' . __( 'If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.' ) . '</p>';
119
+			'<p>'.__('In this section you should explain what rights your users have over their data and how they can invoke those rights.').'</p>'. 
120
+			'<p>'.__('If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.').'</p>';
121 121
 
122 122
 		$content .=
123
-			'<h2>' . __( 'Where we send your data' ) . '</h2>';
123
+			'<h2>'.__('Where we send your data').'</h2>';
124 124
 		$content .=
125
-			'<p>' . __( 'In this section you should list all transfers of your site data outside the European Union and describe the means by which that data is safeguarded to European data protection standards. This could include your web hosting, cloud storage, or other third party services.' ) . '</p>' .
126
-			'<p>' . __( 'European data protection law requires data about European residents which is transferred outside the European Union to be safeguarded to the same standards as if the data was in Europe. So in addition to listing where data goes, you should describe how you ensure that these standards are met either by yourself or by your third party providers, whether that is through an agreement such as Privacy Shield, model clauses in your contracts, or binding corporate rules.' ) . '</p>' . 
127
-			'<p>' . __( 'Visitor comments may be checked through an automated spam detection service.' ) . '</p>';
125
+			'<p>'.__('In this section you should list all transfers of your site data outside the European Union and describe the means by which that data is safeguarded to European data protection standards. This could include your web hosting, cloud storage, or other third party services.').'</p>'.
126
+			'<p>'.__('European data protection law requires data about European residents which is transferred outside the European Union to be safeguarded to the same standards as if the data was in Europe. So in addition to listing where data goes, you should describe how you ensure that these standards are met either by yourself or by your third party providers, whether that is through an agreement such as Privacy Shield, model clauses in your contracts, or binding corporate rules.').'</p>'. 
127
+			'<p>'.__('Visitor comments may be checked through an automated spam detection service.').'</p>';
128 128
 
129 129
 		$content .=
130
-			'<h2>' . __( 'Additional information' ) . '</h2>';
130
+			'<h2>'.__('Additional information').'</h2>';
131 131
 		$content .=
132
-			'<p>' . __( 'If you use your site for commercial purposes and you engage in more complex collection or processing of personal data, you should note the following information in your privacy policy in addition to the information we have already discussed.' ) . '</p>';
132
+			'<p>'.__('If you use your site for commercial purposes and you engage in more complex collection or processing of personal data, you should note the following information in your privacy policy in addition to the information we have already discussed.').'</p>';
133 133
 
134 134
 		$content .=
135
-			'<h3>' . __( 'How we protect your data' ) . '</h3>';
135
+			'<h3>'.__('How we protect your data').'</h3>';
136 136
 		$content .=
137
-			'<p>' . __( 'In this section you should explain what measures you have taken to protect your users&#8217; data. This could include technical measures such as encryption; security measures such as two factor authentication; and measures such as staff training in data protection. If you have carried out a Privacy Impact Assessment, you can mention it here too.' ) . '</p>';
137
+			'<p>'.__('In this section you should explain what measures you have taken to protect your users&#8217; data. This could include technical measures such as encryption; security measures such as two factor authentication; and measures such as staff training in data protection. If you have carried out a Privacy Impact Assessment, you can mention it here too.').'</p>';
138 138
 
139 139
 		$content .=
140
-			'<h3>' . __( 'What data breach procedures we have in place' ) . '</h3>';
140
+			'<h3>'.__('What data breach procedures we have in place').'</h3>';
141 141
 		$content .=
142
-			'<p>' . __( 'In this section you should explain what procedures you have in place to deal with data breaches, either potential or real, such as internal reporting systems, contact mechanisms, or bug bounties.' ) . '</p>';
142
+			'<p>'.__('In this section you should explain what procedures you have in place to deal with data breaches, either potential or real, such as internal reporting systems, contact mechanisms, or bug bounties.').'</p>';
143 143
 
144 144
 		$content .=
145
-			'<h3>' . __( 'What third parties we receive data from' ) . '</h3>';
145
+			'<h3>'.__('What third parties we receive data from').'</h3>';
146 146
 		$content .=
147
-			'<p>' . __( 'If your web site receives data about users from third parties, including advertisers, this information must be included within the section of your privacy policy dealing with third party data.' ) . '</p>';
147
+			'<p>'.__('If your web site receives data about users from third parties, including advertisers, this information must be included within the section of your privacy policy dealing with third party data.').'</p>';
148 148
 
149 149
 		$content .=
150
-			'<h3>' . __( 'What automated decision making and/or profiling we do with user data' ) . '</h3>';
150
+			'<h3>'.__('What automated decision making and/or profiling we do with user data').'</h3>';
151 151
 		$content .=
152
-			'<p>' . __( 'If your web site provides a service which includes automated decision making - for example, allowing customers to apply for credit, or aggregating their data into an advertising profile - you must note that this is taking place, and include information about how that information is used, what decisions are made with that aggregated data, and what rights users have over decisions made without human intervention.' ) . '</p>';
152
+			'<p>'.__('If your web site provides a service which includes automated decision making - for example, allowing customers to apply for credit, or aggregating their data into an advertising profile - you must note that this is taking place, and include information about how that information is used, what decisions are made with that aggregated data, and what rights users have over decisions made without human intervention.').'</p>';
153 153
 
154 154
 		$content .=
155
-			'<h3>' . __( 'Industry regulatory disclosure requirements' ) . '</h3>';
155
+			'<h3>'.__('Industry regulatory disclosure requirements').'</h3>';
156 156
 		$content .=
157
-			'<p>' . __( 'If you are a member of a regulated industry, or if you are subject to additional privacy laws, you may be required to disclose that information here.' ) . '</p>' .
157
+			'<p>'.__('If you are a member of a regulated industry, or if you are subject to additional privacy laws, you may be required to disclose that information here.').'</p>'.
158 158
 			'</div>';
159 159
 
160
-		return apply_filters( 'geodir_privacy_policy_content', $content );
160
+		return apply_filters('geodir_privacy_policy_content', $content);
161 161
 	}
162 162
 
163 163
 	/**
164 164
 	 * Spawn events for order cleanup.
165 165
 	 */
166 166
 	public function queue_cleanup_personal_data() {
167
-		self::$background_process->push_to_queue( array( 'task' => 'trash_pending_posts' ) );
168
-		self::$background_process->push_to_queue( array( 'task' => 'anonymize_published_posts' ) );
167
+		self::$background_process->push_to_queue(array('task' => 'trash_pending_posts'));
168
+		self::$background_process->push_to_queue(array('task' => 'anonymize_published_posts'));
169 169
 		self::$background_process->save()->dispatch();
170 170
 	}
171 171
 
@@ -177,15 +177,15 @@  discard block
 block discarded – undo
177 177
 	 * @param string $data The data being anonymized.
178 178
 	 * @return string Anonymized string.
179 179
 	 */
180
-	public function anonymize_custom_data_types( $anonymous, $type, $data ) {
181
-		switch ( $type ) {
180
+	public function anonymize_custom_data_types($anonymous, $type, $data) {
181
+		switch ($type) {
182 182
 			case 'city':
183 183
 			case 'region':
184 184
 			case 'country':
185 185
 				$anonymous = '';
186 186
 				break;
187 187
 			case 'phone':
188
-				$anonymous = preg_replace( '/\d/u', '0', $data );
188
+				$anonymous = preg_replace('/\d/u', '0', $data);
189 189
 				break;
190 190
 			case 'numeric_id':
191 191
 				$anonymous = 0;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @param  int $limit Limit posts to process per batch.
202 202
 	 * @return int Number of posts processed.
203 203
 	 */
204
-	public static function trash_pending_posts( $limit = 20 ) {
204
+	public static function trash_pending_posts($limit = 20) {
205 205
 		return 0;
206 206
 	}
207 207
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 * @param  int $limit Limit posts to process per batch.
213 213
 	 * @return int Number of posts processed.
214 214
 	 */
215
-	public static function anonymize_published_posts( $limit = 20 ) {
215
+	public static function anonymize_published_posts($limit = 20) {
216 216
 		return 0;
217 217
 	}
218 218
 
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
 	 * @param array $query Query array to pass to wc_get_orders().
224 224
 	 * @return int Count of orders that were trashed.
225 225
 	 */
226
-	protected static function trash_posts_query( $query ) {
226
+	protected static function trash_posts_query($query) {
227 227
 		$posts = array();
228
-		$count  = 0;
228
+		$count = 0;
229 229
 
230
-		if ( $posts ) {
231
-			foreach ( $posts as $post ) {
232
-				$count ++;
230
+		if ($posts) {
231
+			foreach ($posts as $post) {
232
+				$count++;
233 233
 			}
234 234
 		}
235 235
 
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 	 * @param array $query Query array.
244 244
 	 * @return int Count of orders that were anonymized.
245 245
 	 */
246
-	protected static function anonymize_posts_query( $query ) {
246
+	protected static function anonymize_posts_query($query) {
247 247
 		$posts = array();
248
-		$count  = 0;
248
+		$count = 0;
249 249
 
250
-		if ( $posts ) {
251
-			foreach ( $posts as $post ) {
252
-				GeoDir_Privacy_Erasers::remove_post_personal_data( $post );
253
-				$count ++;
250
+		if ($posts) {
251
+			foreach ($posts as $post) {
252
+				GeoDir_Privacy_Erasers::remove_post_personal_data($post);
253
+				$count++;
254 254
 			}
255 255
 		}
256 256
 
@@ -276,48 +276,48 @@  discard block
 block discarded – undo
276 276
 		 *     }
277 277
 		 * }
278 278
 		 */
279
-		$exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
279
+		$exporters = apply_filters('wp_privacy_personal_data_exporters', array());
280 280
 
281 281
 		return $exporters;
282 282
 	}
283 283
 
284 284
 	public static function get_personal_data_exporter_key() {
285
-		if ( empty( $_POST['id'] ) ) {
285
+		if (empty($_POST['id'])) {
286 286
 			return false;
287 287
 		}
288 288
 		$request_id = (int) $_POST['id'];
289 289
 
290
-		if ( $request_id < 1 ) {
290
+		if ($request_id < 1) {
291 291
 			return false;
292 292
 		}
293 293
 
294
-		if ( ! current_user_can( 'export_others_personal_data' ) ) {
294
+		if (!current_user_can('export_others_personal_data')) {
295 295
 			return false;
296 296
 		}
297 297
 
298 298
 		// Get the request data.
299
-		$request = wp_get_user_request_data( $request_id );
299
+		$request = wp_get_user_request_data($request_id);
300 300
 
301
-		if ( ! $request || 'export_personal_data' !== $request->action_name ) {
301
+		if (!$request || 'export_personal_data' !== $request->action_name) {
302 302
 			return false;
303 303
 		}
304 304
 
305 305
 		$email_address = $request->email;
306
-		if ( ! is_email( $email_address ) ) {
306
+		if (!is_email($email_address)) {
307 307
 			return false;
308 308
 		}
309 309
 
310
-		if ( ! isset( $_POST['exporter'] ) ) {
310
+		if (!isset($_POST['exporter'])) {
311 311
 			return false;
312 312
 		}
313 313
 		$exporter_index = (int) $_POST['exporter'];
314 314
 
315
-		if ( ! isset( $_POST['page'] ) ) {
315
+		if (!isset($_POST['page'])) {
316 316
 			return false;
317 317
 		}
318 318
 		$page = (int) $_POST['page'];
319 319
 
320
-		$send_as_email = isset( $_POST['sendAsEmail'] ) ? ( 'true' === $_POST['sendAsEmail'] ) : false;
320
+		$send_as_email = isset($_POST['sendAsEmail']) ? ('true' === $_POST['sendAsEmail']) : false;
321 321
 
322 322
 		/**
323 323
 		 * Filters the array of exporter callbacks.
@@ -338,37 +338,37 @@  discard block
 block discarded – undo
338 338
 		 *     }
339 339
 		 * }
340 340
 		 */
341
-		$exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
341
+		$exporters = apply_filters('wp_privacy_personal_data_exporters', array());
342 342
 
343
-		if ( ! is_array( $exporters ) ) {
343
+		if (!is_array($exporters)) {
344 344
 			return false;
345 345
 		}
346 346
 
347 347
 		// Do we have any registered exporters?
348
-		if ( 0 < count( $exporters ) ) {
349
-			if ( $exporter_index < 1 ) {
348
+		if (0 < count($exporters)) {
349
+			if ($exporter_index < 1) {
350 350
 				return false;
351 351
 			}
352 352
 
353
-			if ( $exporter_index > count( $exporters ) ) {
353
+			if ($exporter_index > count($exporters)) {
354 354
 				return false;
355 355
 			}
356 356
 
357
-			if ( $page < 1 ) {
357
+			if ($page < 1) {
358 358
 				return false;
359 359
 			}
360 360
 
361
-			$exporter_keys = array_keys( $exporters );
362
-			$exporter_key  = $exporter_keys[ $exporter_index - 1 ];
363
-			$exporter      = $exporters[ $exporter_key ];
361
+			$exporter_keys = array_keys($exporters);
362
+			$exporter_key  = $exporter_keys[$exporter_index - 1];
363
+			$exporter      = $exporters[$exporter_key];
364 364
 			
365
-			if ( ! is_array( $exporter ) || empty( $exporter_key ) ) {
365
+			if (!is_array($exporter) || empty($exporter_key)) {
366 366
 				return false;
367 367
 			}
368
-			if ( ! array_key_exists( 'exporter_friendly_name', $exporter ) ) {
368
+			if (!array_key_exists('exporter_friendly_name', $exporter)) {
369 369
 				return false;
370 370
 			}
371
-			if ( ! array_key_exists( 'callback', $exporter ) ) {
371
+			if (!array_key_exists('callback', $exporter)) {
372 372
 				return false;
373 373
 			}
374 374
 		}
@@ -386,52 +386,52 @@  discard block
 block discarded – undo
386 386
 		 * @param int    $request_id      The privacy request post ID associated with this request.
387 387
 		 * @param bool   $send_as_email   Whether the final results of the export should be emailed to the user.
388 388
 		 */
389
-		$exporter_key = apply_filters( 'geodir_privacy_personal_data_exporter', $exporter_key, $exporter, $exporter_index, $email_address, $page, $request_id, $send_as_email );
389
+		$exporter_key = apply_filters('geodir_privacy_personal_data_exporter', $exporter_key, $exporter, $exporter_index, $email_address, $page, $request_id, $send_as_email);
390 390
 
391 391
 		return $exporter_key;
392 392
 	}
393 393
 
394 394
 	public static function personal_data_exporter_key() {
395
-		if ( ! wp_doing_ajax() ) {
395
+		if (!wp_doing_ajax()) {
396 396
 			return false;
397 397
 		}
398 398
 
399
-		if ( empty( $_POST['id'] ) ) {
399
+		if (empty($_POST['id'])) {
400 400
 			return false;
401 401
 		}
402 402
 		$request_id = (int) $_POST['id'];
403 403
 
404
-		if ( $request_id < 1 ) {
404
+		if ($request_id < 1) {
405 405
 			return false;
406 406
 		}
407 407
 
408
-		if ( ! current_user_can( 'export_others_personal_data' ) ) {
408
+		if (!current_user_can('export_others_personal_data')) {
409 409
 			return false;
410 410
 		}
411 411
 
412 412
 		// Get the request data.
413
-		$request = wp_get_user_request_data( $request_id );
413
+		$request = wp_get_user_request_data($request_id);
414 414
 
415
-		if ( ! $request || 'export_personal_data' !== $request->action_name ) {
415
+		if (!$request || 'export_personal_data' !== $request->action_name) {
416 416
 			return false;
417 417
 		}
418 418
 
419 419
 		$email_address = $request->email;
420
-		if ( ! is_email( $email_address ) ) {
420
+		if (!is_email($email_address)) {
421 421
 			return false;
422 422
 		}
423 423
 
424
-		if ( ! isset( $_POST['exporter'] ) ) {
424
+		if (!isset($_POST['exporter'])) {
425 425
 			return false;
426 426
 		}
427 427
 		$exporter_index = (int) $_POST['exporter'];
428 428
 
429
-		if ( ! isset( $_POST['page'] ) ) {
429
+		if (!isset($_POST['page'])) {
430 430
 			return false;
431 431
 		}
432 432
 		$page = (int) $_POST['page'];
433 433
 
434
-		$send_as_email = isset( $_POST['sendAsEmail'] ) ? ( 'true' === $_POST['sendAsEmail'] ) : false;
434
+		$send_as_email = isset($_POST['sendAsEmail']) ? ('true' === $_POST['sendAsEmail']) : false;
435 435
 
436 436
 		/**
437 437
 		 * Filters the array of exporter callbacks.
@@ -452,37 +452,37 @@  discard block
 block discarded – undo
452 452
 		 *     }
453 453
 		 * }
454 454
 		 */
455
-		$exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
455
+		$exporters = apply_filters('wp_privacy_personal_data_exporters', array());
456 456
 
457
-		if ( ! is_array( $exporters ) ) {
457
+		if (!is_array($exporters)) {
458 458
 			return false;
459 459
 		}
460 460
 
461 461
 		// Do we have any registered exporters?
462
-		if ( 0 < count( $exporters ) ) {
463
-			if ( $exporter_index < 1 ) {
462
+		if (0 < count($exporters)) {
463
+			if ($exporter_index < 1) {
464 464
 				return false;
465 465
 			}
466 466
 
467
-			if ( $exporter_index > count( $exporters ) ) {
467
+			if ($exporter_index > count($exporters)) {
468 468
 				return false;
469 469
 			}
470 470
 
471
-			if ( $page < 1 ) {
471
+			if ($page < 1) {
472 472
 				return false;
473 473
 			}
474 474
 
475
-			$exporter_keys = array_keys( $exporters );
476
-			$exporter_key  = $exporter_keys[ $exporter_index - 1 ];
477
-			$exporter      = $exporters[ $exporter_key ];
475
+			$exporter_keys = array_keys($exporters);
476
+			$exporter_key  = $exporter_keys[$exporter_index - 1];
477
+			$exporter      = $exporters[$exporter_key];
478 478
 			
479
-			if ( ! is_array( $exporter ) || empty( $exporter_key ) ) {
479
+			if (!is_array($exporter) || empty($exporter_key)) {
480 480
 				return false;
481 481
 			}
482
-			if ( ! array_key_exists( 'exporter_friendly_name', $exporter ) ) {
482
+			if (!array_key_exists('exporter_friendly_name', $exporter)) {
483 483
 				return false;
484 484
 			}
485
-			if ( ! array_key_exists( 'callback', $exporter ) ) {
485
+			if (!array_key_exists('callback', $exporter)) {
486 486
 				return false;
487 487
 			}
488 488
 		}
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 		 * @param int    $request_id      The privacy request post ID associated with this request.
501 501
 		 * @param bool   $send_as_email   Whether the final results of the export should be emailed to the user.
502 502
 		 */
503
-		$exporter_key = apply_filters( 'geodir_privacy_personal_data_exporter', $exporter_key, $exporter, $exporter_index, $email_address, $page, $request_id, $send_as_email );
503
+		$exporter_key = apply_filters('geodir_privacy_personal_data_exporter', $exporter_key, $exporter, $exporter_index, $email_address, $page, $request_id, $send_as_email);
504 504
 
505 505
 		return $exporter_key;
506 506
 	}
@@ -508,17 +508,17 @@  discard block
 block discarded – undo
508 508
 	public static function exporter_post_type() {
509 509
 		$exporter_key = self::personal_data_exporter_key();
510 510
 
511
-		if ( empty( $exporter_key ) ) {
511
+		if (empty($exporter_key)) {
512 512
 			return false;
513 513
 		}
514 514
 
515
-		if ( strpos( $exporter_key, 'geodirectory-post-' ) !== 0 ) {
515
+		if (strpos($exporter_key, 'geodirectory-post-') !== 0) {
516 516
 			return false;
517 517
 		}
518 518
 
519
-		$post_type = str_replace( 'geodirectory-post-', '', $exporter_key );
519
+		$post_type = str_replace('geodirectory-post-', '', $exporter_key);
520 520
 
521
-		if ( $post_type != '' && in_array( $post_type, geodir_get_posttypes() ) ) {
521
+		if ($post_type != '' && in_array($post_type, geodir_get_posttypes())) {
522 522
 			return $post_type;
523 523
 		}
524 524
 
Please login to merge, or discard this patch.