Automattic\WooCommerce\Internal\Logging

RemoteLogger::sanitize()privateWC 1.0

Sanitize the content to exclude sensitive data.

The trace is sanitized by:

  1. Remove the absolute path to the WooCommerce plugin directory.
  2. Remove the absolute path to the WordPress root directory.

For example, the trace:

/var/www/html/wp-content/plugins/woocommerce/includes/class-wc-remote-logger.php on line 123 will be sanitized to: **\/woocommerce/includes/class-wc-remote-logger.php on line 123

Метод класса: RemoteLogger{}

Хуков нет.

Возвращает

Строку. The sanitized message.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->sanitize( $message );
$message(строка) (обязательный)
The message to sanitize.

Код RemoteLogger::sanitize() WC 9.3.3

private function sanitize( $message ) {
	if ( ! is_string( $message ) ) {
		return $message;
	}

	$wc_path = StringUtil::normalize_local_path_slashes( WC_ABSPATH );
	$wp_path = StringUtil::normalize_local_path_slashes( ABSPATH );

	$sanitized = str_replace(
		array( $wc_path, $wp_path ),
		array( '**/' . dirname( WC_PLUGIN_BASENAME ) . '/', '**/' ),
		$message
	);

	return $sanitized;
}