include_list = apply_filters( 'wpseo_tracking_settings_include_list', $this->include_list ); $options = WPSEO_Options::get_all(); // Returns the settings of which the keys intersect with the values of the include list. $options = array_intersect_key( $options, array_flip( $this->include_list ) ); return [ 'settings' => $this->anonymize_settings( $options ), ]; } /** * Anonimizes the WPSEO_Options array by replacing all $anonymous_settings values to 'used'. * * @param array $settings The settings. * * @return array The anonymized settings. */ private function anonymize_settings( $settings ) { foreach ( $this->anonymous_settings as $setting ) { if ( ! empty( $settings[ $setting ] ) ) { $settings[ $setting ] = 'used'; } } return $settings; } }