Privacy). */ public static function policy_text() { if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) { return; } $text = '

' . __( 'When you visit this website we store a first-party cookie (aarye_attr) with how you arrived: the ad, search engine or website that sent you, the advertising tags in the link (such as utm_campaign or a click ID) and the first page you saw. It also holds signs that a person is using the page, used only to tell real enquiries from spam: the number of pages viewed, when the current page was opened, whether the mouse, touch screen or keyboard was used, whether the browser is controlled by automation software, the time zone and the screen size. A second cookie (aarye_vid) holds a random visitor number. When you send a form, this information is saved with your entry so we know which of our ads or channels brought you. The cookies expire after 90 days.', 'aarye-marketing-addon' ) . '

'; if ( '' !== (string) AARYE_Settings::get( 'sheets_url' ) ) { $text .= '

' . __( 'Form entries, with how you arrived, are also added to a Google Sheet that we own, so they are stored by Google (Google Privacy Policy: https://policies.google.com/privacy).', 'aarye-marketing-addon' ) . '

'; } wp_add_privacy_policy_content( 'Aarye Marketing Addon', wp_kses_post( $text ) ); } /** * Register the exporter. * * @param array $exporters Exporters. * @return array */ public static function register_exporter( $exporters ) { $exporters['aarye-marketing-addon'] = array( 'exporter_friendly_name' => __( 'Leads (Aarye)', 'aarye-marketing-addon' ), 'callback' => array( __CLASS__, 'export' ), ); return $exporters; } /** * Register the eraser. * * @param array $erasers Erasers. * @return array */ public static function register_eraser( $erasers ) { $erasers['aarye-marketing-addon'] = array( 'eraser_friendly_name' => __( 'Leads (Aarye)', 'aarye-marketing-addon' ), 'callback' => array( __CLASS__, 'erase' ), ); return $erasers; } /** * Entries of an email address. * * @param string $email Email. * @param int $page Page (1-based). * @return object[] */ private static function entries_for( $email, $page ) { global $wpdb; // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- Our own table. return (array) $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM %i WHERE email = %s ORDER BY id LIMIT 50 OFFSET %d', AARYE_Entries::table(), $email, ( $page - 1 ) * 50 ) ); } /** * Export. * * @param string $email Email. * @param int $page Page. * @return array */ public static function export( $email, $page = 1 ) { $rows = self::entries_for( $email, $page ); $data = array(); foreach ( $rows as $e ) { $items = array( array( 'name' => __( 'Date', 'aarye-marketing-addon' ), 'value' => $e->created_at ), array( 'name' => __( 'Form', 'aarye-marketing-addon' ), 'value' => $e->form_name ), array( 'name' => __( 'Came from', 'aarye-marketing-addon' ), 'value' => $e->source_label . ( '' !== $e->campaign ? ' ยท ' . $e->campaign : '' ) ), array( 'name' => __( 'IP address', 'aarye-marketing-addon' ), 'value' => $e->ip ), ); foreach ( AARYE_Entries::json( $e, 'fields' ) as $field ) { $items[] = array( 'name' => $field['label'], 'value' => $field['value'] ); } $data[] = array( 'group_id' => 'aarye-entries', 'group_label' => __( 'Leads (Aarye)', 'aarye-marketing-addon' ), 'item_id' => 'aarye-entry-' . $e->id, 'data' => $items, ); } return array( 'data' => $data, 'done' => count( $rows ) < 50, ); } /** * Erase. * * @param string $email Email. * @param int $page Page. * @return array */ public static function erase( $email, $page = 1 ) { $rows = self::entries_for( $email, 1 ); foreach ( $rows as $e ) { AARYE_Entries::delete( $e->id ); } return array( 'items_removed' => count( $rows ) > 0, 'items_retained' => false, 'messages' => array(), 'done' => count( $rows ) < 50, ); } }