HEX
Server: nginx
System: Linux pool195-106-36.bur.atomicsites.net 6.12.57+deb12-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.57-1~bpo12+1 (2025-11-17) x86_64
User: (0)
PHP: 8.3.32
Disabled: pcntl_fork
Upload Files
File: /wordpress/plugins/wp-cloud-client/1.1.3/src/Support/functions.php
<?php

declare(strict_types=1);

if ( ! function_exists( 'wpcc_whitelabel_email' ) ) {
	/**
	 * Transform a @vendasta.com address to its whitelabeled @support.websitepro.hosting equivalent.
	 *
	 * Domain match is case-insensitive (per RFC 5321) and the rewritten local-part
	 * is lowercased so callers can't drift between casings of the same identity.
	 * `+suffix` tags are stripped, but a leading `+` is preserved so the local-part
	 * never sanitizes down to an empty username.
	 *
	 * @param string $email The email address to transform.
	 * @return string The whitelabeled email, or the original if no transformation applies.
	 */
	function wpcc_whitelabel_email( string $email ): string {
		$domain = '@vendasta.com';
		$size   = strlen( $domain );

		if ( '' === $email || 0 !== strcasecmp( substr( $email, -$size ), $domain ) ) {
			return $email;
		}

		$id  = strtolower( substr( $email, 0, -$size ) );
		$pos = strpos( $id, '+' );
		if ( false !== $pos && $pos > 0 ) {
			$id = substr( $id, 0, $pos );
		}

		return $id . '@support.websitepro.hosting';
	}
}