Restrict the BN code to return only the white listed values

This commit is contained in:
Narek Zakarian 2025-03-21 19:06:09 +04:00
parent 95af76b8fb
commit 2616974c12
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7

View file

@ -80,6 +80,12 @@ class PartnerAttribution {
* @return string The stored BN Code, or the default value if no path is detected. * @return string The stored BN Code, or the default value if no path is detected.
*/ */
public function get_bn_code(): string { public function get_bn_code(): string {
return get_option( $this->bn_code_option_name, $this->default_bn_code ) ?? $this->default_bn_code; $bn_code = get_option( $this->bn_code_option_name, $this->default_bn_code ) ?? $this->default_bn_code;
if ( ! in_array( $bn_code, $this->bn_codes, true ) && $bn_code !== $this->default_bn_code ) {
return $this->default_bn_code;
}
return $bn_code;
} }
} }