Changeset 7738 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/privacy.php
- Timestamp:
- 10/17/2018 11:01:41 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/privacy.php
r7737 r7738 12 12 add_filter( 'the_posts', __NAMESPACE__ . '\hide_others_payment_files', 10, 2 ); 13 13 add_filter( 'wp_privacy_personal_data_exporters', __NAMESPACE__ . '\register_personal_data_exporters' ); 14 add_filter( 'wp_privacy_personal_data_erasers', __NAMESPACE__ . '\register_personal_data_erasers');14 add_filter( 'wp_privacy_personal_data_erasers', __NAMESPACE__ . '\register_personal_data_erasers' ); 15 15 16 16 … … 90 90 'post_type' => array( 91 91 Reimbursement_Requests\POST_TYPE, 92 WCP_Payment_Request::POST_TYPE 92 WCP_Payment_Request::POST_TYPE, 93 93 ), 94 94 ) ); … … 108 108 * This is an empty stub, we are not adding an eraser for now, because it contains data which can be used for 109 109 * accounting or reference purpose. 110 *111 110 */ 112 111 return $erasers; … … 138 137 * 139 138 * @param string $email_address 140 * @param int $page139 * @param int $page 141 140 * 142 141 * @return array 143 142 */ 144 143 function vendor_payment_exporter( $email_address, $page ) { 145 146 144 $results = array( 147 145 'data' => array(), … … 149 147 ); 150 148 151 $vendor_payment_requests = get_post_wp_query( \WCP_Payment_Request::POST_TYPE, $page, $email_address );149 $vendor_payment_requests = get_post_wp_query( WCP_Payment_Request::POST_TYPE, $page, $email_address ); 152 150 153 151 if ( empty( $vendor_payment_requests ) ) { … … 156 154 157 155 $data_to_export = array(); 156 158 157 foreach ( $vendor_payment_requests->posts as $post ) { 159 158 $vendor_payment_exp_data = array(); … … 170 169 171 170 $vendor_payment_exp_data = array_merge( 172 $vendor_payment_exp_data, get_meta_details( $meta, \WCP_Payment_Request::POST_TYPE )171 $vendor_payment_exp_data, get_meta_details( $meta, WCP_Payment_Request::POST_TYPE ) 173 172 ); 174 173 175 174 if ( ! empty( $vendor_payment_exp_data ) ) { 176 175 $data_to_export[] = array( 177 'group_id' => \WCP_Payment_Request::POST_TYPE,176 'group_id' => WCP_Payment_Request::POST_TYPE, 178 177 'group_label' => __( 'WordCamp Vendor Payments', 'wordcamporg' ), 179 'item_id' => \WCP_Payment_Request::POST_TYPE . "-{$post->ID}",178 'item_id' => WCP_Payment_Request::POST_TYPE . "-{$post->ID}", 180 179 'data' => $vendor_payment_exp_data, 181 180 ); … … 193 192 * 194 193 * @param string $email_address 195 * @param int $page194 * @param int $page 196 195 * 197 196 * @return array 198 197 */ 199 198 function reimbursements_exporter( $email_address, $page ) { 200 201 199 $results = array( 202 200 'data' => array(), … … 211 209 212 210 $data_to_export = array(); 211 213 212 foreach ( $reimbursements->posts as $post ) { 214 213 $reimbursement_data_to_export = array(); … … 224 223 ]; 225 224 226 // meta fields225 // Meta fields. 227 226 $reimbursement_data_to_export = array_merge( 228 227 $reimbursement_data_to_export, get_meta_details( $meta, Reimbursement_Requests\POST_TYPE ) 229 228 ); 230 231 229 232 230 if ( ! empty( $reimbursement_data_to_export ) ) { … … 252 250 * because the vendor contact details could be of an individual (instead of a business), and thus is a potential PII 253 251 * 254 * @param $query_type string255 * @param $page integer256 * @param $email_address string Email address of the entity making the request252 * @param string $query_type 253 * @param integer $page 254 * @param string $email_address Email address of the entity making the request. 257 255 * 258 256 * @return null|WP_Query 259 257 */ 260 258 function get_post_wp_query( $query_type, $page, $email_address ) { 261 262 259 $query_args = array( 263 260 'post_type' => $query_type, … … 269 266 270 267 switch ( $query_type ) { 271 case Reimbursement_Requests\POST_TYPE 268 case Reimbursement_Requests\POST_TYPE: 272 269 $user = get_user_by( 'email', $email_address ); 273 270 … … 278 275 $query_args = array_merge( $query_args, array( 'post_author' => $user->ID ) ); 279 276 break; 280 case \WCP_Payment_Request::POST_TYPE : 277 278 case WCP_Payment_Request::POST_TYPE: 281 279 $query_args['meta_query'] = [ 282 280 'relation' => 'AND', … … 288 286 ]; 289 287 break; 290 default : 288 289 default: 291 290 return null; 292 291 } … … 296 295 297 296 /** 298 * @param $meta array meta object of post, as retrieved by `get_post_meta( $post->ID )` 299 * @param $post_type string post_type . could be one of wcb_reimbursement or wcp_payment_request 297 * 298 * @param array $meta Meta object of post, as retrieved by `get_post_meta( $post->ID )`. 299 * @param string $post_type Post type. Could be one of `wcb_reimbursement` or `wcp_payment_request`. 300 300 * 301 301 * @return array Details of the reimbursement request … … 303 303 function get_meta_details( $meta, $post_type ) { 304 304 $meta_details = array(); 305 305 306 foreach ( get_meta_fields_mapping( $post_type ) as $meta_field => $meta_field_name ) { 306 307 $data = isset( $meta[ $meta_field ] ) ? $meta[ $meta_field ] : null; 308 307 309 if ( ! empty( $data ) && is_array( $data ) && ! empty( $data[0] ) ) { 308 310 $meta_details[] = [ … … 319 321 * Returns array of meta fields and their titles that we want to allow export for. 320 322 * 321 * @param $post_type string323 * @param string $post_type 322 324 * 323 325 * @return array … … 327 329 328 330 if ( Reimbursement_Requests\POST_TYPE === $post_type ) { 329 $prefix = '_wcbrr_';331 $prefix = '_wcbrr_'; 330 332 $mapping_fields = array_merge( 331 333 $mapping_fields, … … 335 337 $prefix . 'payment_method' => __( 'Payment Method', 'wordcamporg' ), 336 338 337 // Payment Method - Direct Deposit 339 // Payment Method - Direct Deposit. 338 340 $prefix . 'ach_bank_name' => __( 'Bank Name', 'wordcamporg' ), 339 341 $prefix . 'ach_account_type' => __( 'Account Type', 'wordcamporg' ), … … 342 344 $prefix . 'ach_account_holder_name' => __( 'Account Holder Name', 'wordcamporg' ), 343 345 344 // Payment Method - Check 346 // Payment Method - Check. 345 347 $prefix . 'payable_to' => __( 'Payable To', 'wordcamporg' ), 346 348 $prefix . 'check_street_address' => __( 'Street Address', 'wordcamporg' ), … … 350 352 $prefix . 'check_country' => __( 'Country', 'wordcamporg' ), 351 353 352 // Payment Method - Wire 354 // Payment Method - Wire. 353 355 $prefix . 'bank_name' => __( 'Beneficiary’s Bank Name', 'wordcamporg' ), 354 356 $prefix . 'bank_street_address' => __( 'Beneficiary’s Bank Street Address', 'wordcamporg' ), … … 360 362 $prefix . 'beneficiary_account_number' => __( 'Beneficiary’s Account Number or IBAN', 'wordcamporg' ), 361 363 362 // Intermediary bank details 364 // Intermediary bank details. 363 365 $prefix . 'interm_bank_name' => __( 'Intermediary Bank Name', 'wordcamporg' ), 364 366 $prefix . 'interm_bank_street_address' => __( 'Intermediary Bank Street Address', 'wordcamporg' ), … … 376 378 $prefix . 'beneficiary_zip_code' => __( 'Beneficiary’s ZIP / Postal Code', 'wordcamporg' ), 377 379 $prefix . 'beneficiary_country_iso3166' => __( 'Beneficiary’s Country', 'wordcamporg' ), 378 379 380 ) 380 381 ); 381 } elseif ( \WCP_Payment_Request::POST_TYPE === $post_type ) {382 $prefix = '_camppayments_';382 } elseif ( WCP_Payment_Request::POST_TYPE === $post_type ) { 383 $prefix = '_camppayments_'; 383 384 $mapping_fields = array_merge( 384 385 $mapping_fields, 385 386 array( 386 // Vendor payment fields 387 // Vendor payment fields. 387 388 $prefix . 'description' => __( 'Description', 'wordcamporg' ), 388 389 $prefix . 'general_notes' => __( 'Notes', 'wordcamporg' ), … … 401 402 return $mapping_fields; 402 403 } 403
Note: See TracChangeset
for help on using the changeset viewer.