mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Merge pull request #391 from woocommerce/pcp-446-prefix-input-validation
Add invoice prefix input validation
This commit is contained in:
commit
d3626bf967
2 changed files with 16 additions and 8 deletions
|
@ -88,3 +88,7 @@
|
||||||
.woocommerce_page_wc-settings h3.ppcp-subheading {
|
.woocommerce_page_wc-settings h3.ppcp-subheading {
|
||||||
font-size: 1.1em;
|
font-size: 1.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.input-text[pattern]:invalid {
|
||||||
|
border: red solid 2px;
|
||||||
|
}
|
||||||
|
|
|
@ -737,22 +737,26 @@ return array(
|
||||||
'gateway' => 'paypal',
|
'gateway' => 'paypal',
|
||||||
),
|
),
|
||||||
'prefix' => array(
|
'prefix' => array(
|
||||||
'title' => __( 'Invoice prefix', 'woocommerce-paypal-payments' ),
|
'title' => __( 'Invoice prefix', 'woocommerce-paypal-payments' ),
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
'description' => __( 'If you use your PayPal account with more than one installation, please use a distinct prefix to separate those installations. Please do not use numbers in your prefix.', 'woocommerce-paypal-payments' ),
|
'description' => __( 'If you use your PayPal account with more than one installation, please use a distinct prefix to separate those installations. Please use only English letters and "-", "_" characters.', 'woocommerce-paypal-payments' ),
|
||||||
'default' => ( static function (): string {
|
'maxlength' => 15,
|
||||||
|
'custom_attributes' => array(
|
||||||
|
'pattern' => '[a-zA-Z_-]+',
|
||||||
|
),
|
||||||
|
'default' => ( static function (): string {
|
||||||
$site_url = get_site_url( get_current_blog_id() );
|
$site_url = get_site_url( get_current_blog_id() );
|
||||||
$hash = md5( $site_url );
|
$hash = md5( $site_url );
|
||||||
$letters = preg_replace( '~\d~', '', $hash );
|
$letters = preg_replace( '~\d~', '', $hash );
|
||||||
return substr( $letters, 0, 6 ) . '-';
|
return substr( $letters, 0, 6 ) . '-';
|
||||||
} )(),
|
} )(),
|
||||||
'screens' => array(
|
'screens' => array(
|
||||||
State::STATE_PROGRESSIVE,
|
State::STATE_PROGRESSIVE,
|
||||||
State::STATE_ONBOARDED,
|
State::STATE_ONBOARDED,
|
||||||
),
|
),
|
||||||
'requirements' => array(),
|
'requirements' => array(),
|
||||||
'gateway' => 'paypal',
|
'gateway' => 'paypal',
|
||||||
),
|
),
|
||||||
|
|
||||||
// General button styles.
|
// General button styles.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue