Automattic\WooCommerce\Internal\Logging
RemoteLogger::sanitize()
Sanitize the content to exclude sensitive data.
The trace is sanitized by:
- Remove the absolute path to the WooCommerce plugin directory.
- 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
Method of the class: RemoteLogger{}
No Hooks.
Return
String
. The sanitized message.
Usage
// private - for code of main (parent) class only $result = $this->sanitize( $message );
- $message(string) (required)
- The message to sanitize.
RemoteLogger::sanitize() RemoteLogger::sanitize code 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; }