mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Update random prefix logic to return alphabetic characters only
This commit is contained in:
parent
20ef33f7ee
commit
95adde6740
1 changed files with 8 additions and 2 deletions
|
@ -2106,9 +2106,15 @@ return array(
|
|||
},
|
||||
|
||||
/**
|
||||
* Returns random 6 characters length alphanumeric prefix, followed by a hyphen.
|
||||
* Returns random 6 characters length alphabetic prefix, followed by a hyphen.
|
||||
*/
|
||||
'wcgateway.settings.invoice-prefix-random' => static function( ContainerInterface $container ): string {
|
||||
return wp_generate_password( 6, false ) . '-';
|
||||
$characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$prefix = '';
|
||||
for ( $i = 0; $i < 6; $i++ ) {
|
||||
$prefix .= $characters[ wp_rand( 0, strlen( $characters ) - 1 ) ];
|
||||
}
|
||||
|
||||
return $prefix . '-';
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue