@@ 1186-1192 (lines=7) @@ | ||
1183 | } |
|
1184 | } |
|
1185 | ||
1186 | public function validate_publishable_key_field( $key, $value ) { |
|
1187 | $value = $this->validate_text_field( $key, $value ); |
|
1188 | if ( ! empty( $value ) && ! preg_match( '/^pk_live_/', $value ) ) { |
|
1189 | throw new Exception( __( 'The "Live Publishable Key" should start with "pk_live", enter the correct key.', 'woocommerce-gateway-stripe' ) ); |
|
1190 | } |
|
1191 | return $value; |
|
1192 | } |
|
1193 | ||
1194 | public function validate_secret_key_field( $key, $value ) { |
|
1195 | $value = $this->validate_text_field( $key, $value ); |
|
@@ 1194-1200 (lines=7) @@ | ||
1191 | return $value; |
|
1192 | } |
|
1193 | ||
1194 | public function validate_secret_key_field( $key, $value ) { |
|
1195 | $value = $this->validate_text_field( $key, $value ); |
|
1196 | if ( ! empty( $value ) && ! preg_match( '/^[rs]k_live_/', $value ) ) { |
|
1197 | throw new Exception( __( 'The "Live Secret Key" should start with "sk_live" or "rk_live", enter the correct key.', 'woocommerce-gateway-stripe' ) ); |
|
1198 | } |
|
1199 | return $value; |
|
1200 | } |
|
1201 | ||
1202 | public function validate_test_publishable_key_field( $key, $value ) { |
|
1203 | $value = $this->validate_text_field( $key, $value ); |
|
@@ 1202-1208 (lines=7) @@ | ||
1199 | return $value; |
|
1200 | } |
|
1201 | ||
1202 | public function validate_test_publishable_key_field( $key, $value ) { |
|
1203 | $value = $this->validate_text_field( $key, $value ); |
|
1204 | if ( ! empty( $value ) && ! preg_match( '/^pk_test_/', $value ) ) { |
|
1205 | throw new Exception( __( 'The "Test Publishable Key" should start with "pk_test", enter the correct key.', 'woocommerce-gateway-stripe' ) ); |
|
1206 | } |
|
1207 | return $value; |
|
1208 | } |
|
1209 | ||
1210 | public function validate_test_secret_key_field( $key, $value ) { |
|
1211 | $value = $this->validate_text_field( $key, $value ); |
|
@@ 1210-1216 (lines=7) @@ | ||
1207 | return $value; |
|
1208 | } |
|
1209 | ||
1210 | public function validate_test_secret_key_field( $key, $value ) { |
|
1211 | $value = $this->validate_text_field( $key, $value ); |
|
1212 | if ( ! empty( $value ) && ! preg_match( '/^[rs]k_test_/', $value ) ) { |
|
1213 | throw new Exception( __( 'The "Test Secret Key" should start with "sk_test" or "rk_test", enter the correct key.', 'woocommerce-gateway-stripe' ) ); |
|
1214 | } |
|
1215 | return $value; |
|
1216 | } |
|
1217 | ||
1218 | /** |
|
1219 | * Ensures the statement descriptor about to be saved to options does not contain any invalid characters. |