__( 'SendFleet email log', 'sendfleet' ), 'callback' => array( __CLASS__, 'export' ), ); return $exporters; } /** * Adds the eraser. * * @param array $erasers Erasers. * @return array */ public static function register_eraser( $erasers ) { $erasers['sendfleet'] = array( 'eraser_friendly_name' => __( 'SendFleet email log', 'sendfleet' ), 'callback' => array( __CLASS__, 'erase' ), ); return $erasers; } /** * Exports log rows and the suppression entry for an address. * * @param string $email Address. * @param int $page Page. * @return array */ public static function export( $email, $page = 1 ) { $items = array(); $rows = Log::for_recipient( $email, self::PAGE_SIZE, $page ); foreach ( $rows as $row ) { $items[] = array( 'group_id' => 'sendfleet-log', 'group_label' => __( 'Emails sent through SendFleet', 'sendfleet' ), 'item_id' => 'sendfleet-log-' . $row['id'], 'data' => array( array( 'name' => __( 'Date (UTC)', 'sendfleet' ), 'value' => $row['created_at'], ), array( 'name' => __( 'Recipient', 'sendfleet' ), 'value' => $row['recipient'], ), array( 'name' => __( 'Sender', 'sendfleet' ), 'value' => $row['from_email'], ), array( 'name' => __( 'Subject', 'sendfleet' ), 'value' => $row['subject'], ), array( 'name' => __( 'Status', 'sendfleet' ), 'value' => $row['status'], ), ), ); } $done = count( $rows ) < self::PAGE_SIZE; if ( $done ) { $suppression = Suppressions::find( $email ); if ( $suppression ) { $items[] = array( 'group_id' => 'sendfleet-suppression', 'group_label' => __( 'SendFleet suppression list', 'sendfleet' ), 'item_id' => 'sendfleet-suppression-' . $suppression['id'], 'data' => array( array( 'name' => __( 'Address', 'sendfleet' ), 'value' => $suppression['email'], ), array( 'name' => __( 'Reason', 'sendfleet' ), 'value' => $suppression['reason'], ), array( 'name' => __( 'Added (UTC)', 'sendfleet' ), 'value' => $suppression['created_at'], ), ), ); } } return array( 'data' => $items, 'done' => $done, ); } /** * Erases log rows for an address. The suppression entry is kept, because * removing it would let mail flow again to an address that bounced or * complained; that is reported as retained. * * @param string $email Address. * @param int $page Page. * @return array */ public static function erase( $email, $page = 1 ) { unset( $page ); $removed = Log::delete_for_recipient( $email ); $messages = array(); $retained = false; if ( Suppressions::find( $email ) ) { $retained = true; $messages[] = __( 'The address stays on the SendFleet suppression list so that no further email is sent to it. Remove it under SendFleet → Email Log → Suppressions if that is required.', 'sendfleet' ); } return array( 'items_removed' => $removed > 0, 'items_retained' => $retained, 'messages' => $messages, 'done' => true, ); } /** * Suggests privacy policy text. * * @return void */ public static function policy_content() { if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) { return; } $content = '
' . __( 'This site sends email (for example account, order and form notifications) through SendFleet, a transactional email service. To deliver a message, the recipient address, sender, subject, message content and any attachments are transmitted to SendFleet (api.sendfleet.net).', 'sendfleet' ) . '
' . '' . __( 'Depending on the SendFleet plan the site uses, messages are sent either through the site owner\'s own Amazon SES account, in which case SendFleet does not store recipients, subjects or bodies, or through SendFleet\'s managed infrastructure, in which case SendFleet keeps an email log including message content for 14 days.', 'sendfleet' ) . '
' . '' . __( 'This site keeps its own log of sent email (recipient, sender, subject and delivery status, but not the message content) for a limited period.', 'sendfleet' ) . '
' /* translators: %s: URL of the SendFleet privacy policy. */ . '' . sprintf( __( 'SendFleet privacy policy: %s', 'sendfleet' ), 'https://sendfleet.net/privacy-policy/' ) . '
'; wp_add_privacy_policy_content( 'SendFleet', wp_kses_post( $content ) ); } }