File: //wordpress/plugins/wp-cloud-client/1.1.5.2/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';
}
}