Falcon_Admin::validate_replyto PHP Метод

validate_replyto() публичный статический Метод

Ensures that the reply-to address is a valid formattable email address
public static validate_replyto ( string $input ) : string
$input string New reply-to address
Результат string Updated reply-to address if valid, otherwise the old address
    public static function validate_replyto($input)
    {
        $oldvalue = Falcon::get_option('bbsub_replyto', '');
        if (strpos($input, '+') !== false) {
            add_settings_error('bbsub_replyto', 'bbsub_replyto_invalid', __('The reply-to address must not contain a plus address section', 'falcon'));
            return $oldvalue;
        }
        list($user_part, $host_part) = explode('@', $input);
        $user_part .= '+%1$s-%2$d-%3$d-%4$s';
        $address = $user_part . '@' . $host_part;
        // Test it out!
        $hash = Falcon::get_hash('5', wp_get_current_user(), '42');
        $formatted = sprintf($address, 5, 42, wp_get_current_user()->ID, $hmac);
        // Check that the resulting email is valid
        if (!is_email($formatted)) {
            add_settings_error('bbsub_replyto', 'bbsub_replyto_invalid', __('The reply-to address must be a valid address', 'falcon'));
            return $oldvalue;
        }
        return $input;
    }