| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace EventEspresso\core\domain\services\admin\privacy\erasure; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use EEM_Attendee; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use EventEspresso\core\services\privacy\erasure\PersonalDataEraserInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * Class EraseAttendeeData | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * Erases attendee data when requested by a site user | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * @package        Event Espresso | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * @author         Mike Nelson | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * @since          $VID:$ | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 15 |  |  |  */ | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  | class EraseAttendeeData implements PersonalDataEraserInterface | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |      * @var EEM_Attendee | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |     protected $attendee_model; | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |      * EraseAttendeeData constructor. | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |      * @param EEM_Attendee $attendee_model | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     public function __construct(EEM_Attendee $attendee_model) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |         $this->attendee_model = $attendee_model; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 33 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |      * Gets a translated string name for the data eraser | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |      * @return string | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     public function name() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         return esc_html__('Event Espresso Attendee Data', 'event_espresso'); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 44 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |      * Erases a "page" of personal user data | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |      * @return array { | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |      * @type boolean $items_removed  whether items were removed successfully or not | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |      * @type boolean $items_retained whether any items were skipped or not | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |      * @type array   $messages       values are messages to show | 
            
                                                                        
                            
            
                                    
            
            
                | 54 |  |  |      * @type boolean $done           whether this eraser is done or has more pages | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |      *               } | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |      * @throws \EE_Error | 
            
                                                                        
                            
            
                                    
            
            
                | 57 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     public function erase($email_address, $page = 1) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         $rows_updated = $this->attendee_model->update( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |                 'ATT_fname'    => esc_html__('Anonymous', 'event_espresso'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |                 'ATT_lname'    => '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |                 'ATT_email'    => '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |                 'ATT_address'  => '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |                 'ATT_address2' => '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |                 'ATT_city'     => '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |                 'STA_ID'       => 0, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |                 'CNT_ISO'      => '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |                 'ATT_zip'      => '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |             ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |             array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |                 array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |                     'ATT_email' => $email_address, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |                 ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |         return array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |             'items_removed'  => (bool) $rows_updated, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |             'items_retained' => false, // always false in this example | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |             'messages'       => array(), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |             'done'           => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         ); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 85 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 86 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | // End of file EraseAttendeeData.php | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 88 |  |  | // Location: EventEspresso\core\domain\services\privacy\erasure/EraseAttendeeData.php | 
            
                                                        
            
                                    
            
            
                | 89 |  |  |  |