' . esc_html__( 'AppsTech PHP Security Scanner', 'appstech-php-security-scanner' ) . ''; $text .= '

' . esc_html__( 'Suggested text. Review it against your own practices.', 'appstech-php-security-scanner' ) . '

'; $text .= '

' . esc_html__( 'This site uses a security scanning plugin. It stores scan results (software versions, configuration findings, scan dates and an audit log of administrator actions) in this site\'s database. Scan results are never sent to the plugin author or to any third party.', 'appstech-php-security-scanner' ) . '

'; $text .= '

' . esc_html__( 'The plugin has an optional vulnerability feed, which is off by default. Only if an administrator turns it on does the plugin download public vulnerability data (about WordPress, PHP, plugins and themes) from api.appstech.co.nz about once a day, when an administrator chooses Check now, and after plugin or theme updates. The request is an anonymous HTTP GET: it does not include this site\'s address, the list of installed plugins or themes, visitor data or any personal data. As with any web request, the server receiving it can see the IP address of this site\'s server. The data originates from Wordfence Intelligence, php.net and WordPress.org. See https://appstech.co.nz/privacy and https://appstech.co.nz/terms.', 'appstech-php-security-scanner' ) . '

'; $text .= '

' . esc_html__( 'Email addresses of people chosen to receive security reports and alerts are stored in the plugin settings. Reports are sent using this site\'s own mail configuration, so they pass through whichever mail service the site uses. Recipients can ask the site administrator to be removed.', 'appstech-php-security-scanner' ) . '

'; wp_add_privacy_policy_content( 'AppsTech PHP Security Scanner', wp_kses_post( $text ) ); } public static function exporters( $exporters ) { $exporters['appstech-php-security-scanner'] = array( 'exporter_friendly_name' => __( 'AppsTech PHP Security Scanner recipients', 'appstech-php-security-scanner' ), 'callback' => array( __CLASS__, 'export' ), ); return $exporters; } public static function erasers( $erasers ) { $erasers['appstech-php-security-scanner'] = array( 'eraser_friendly_name' => __( 'AppsTech PHP Security Scanner recipients', 'appstech-php-security-scanner' ), 'callback' => array( __CLASS__, 'erase' ), ); return $erasers; } /** @return array */ public static function export( $email_address, $page = 1 ) { $data = array(); $lists = self::lists_containing( Settings::all(), $email_address ); if ( $lists ) { $data[] = array( 'group_id' => 'gsfp-recipients', 'group_label' => __( 'Security report recipient', 'appstech-php-security-scanner' ), 'item_id' => 'gsfp-recipient-1', 'data' => array( array( 'name' => __( 'Email address', 'appstech-php-security-scanner' ), 'value' => $email_address, ), array( 'name' => __( 'Receives', 'appstech-php-security-scanner' ), 'value' => implode( ', ', $lists ), ), ), ); } return array( 'data' => $data, 'done' => true, ); } /** @return array */ public static function erase( $email_address, $page = 1 ) { $settings = Settings::all(); $lists = self::lists_containing( $settings, $email_address ); $removed = false; if ( $lists ) { Settings::update( array( 'recipients' => self::without( (array) $settings['recipients'], $email_address ), 'critical_recipients' => self::without( (array) $settings['critical_recipients'], $email_address ), 'vuln_recipients' => self::without( (array) $settings['vuln_recipients'], $email_address ), ) ); $removed = true; } return array( 'items_removed' => $removed, 'items_retained' => false, 'messages' => $removed ? array( __( 'The address was removed from security report recipient lists.', 'appstech-php-security-scanner' ) ) : array(), 'done' => true, ); } /** * Pure: which recipient lists contain the address (case-insensitive). * * @param array $settings * @return array */ public static function lists_containing( array $settings, $email ) { $out = array(); if ( self::has( isset( $settings['recipients'] ) ? $settings['recipients'] : array(), $email ) ) { $out[] = 'daily report'; } if ( self::has( isset( $settings['critical_recipients'] ) ? $settings['critical_recipients'] : array(), $email ) ) { $out[] = 'critical alerts'; } if ( self::has( isset( $settings['vuln_recipients'] ) ? $settings['vuln_recipients'] : array(), $email ) ) { $out[] = 'vulnerability alerts'; } return $out; } /** @param mixed $list */ private static function has( $list, $email ) { return in_array( strtolower( (string) $email ), array_map( 'strtolower', array_map( 'strval', (array) $list ) ), true ); } /** * @param array $list * @return array */ public static function without( array $list, $email ) { return array_values( array_filter( $list, function ( $e ) use ( $email ) { return strtolower( (string) $e ) !== strtolower( (string) $email ); } ) ); } }