Skip to content

Commit

Permalink
Merge branch 'develop' into enhancement/#8836-rrm-publication-create.
Browse files Browse the repository at this point in the history
  • Loading branch information
hussain-t committed Jul 30, 2024
2 parents 5253a24 + d777ba4 commit 9348f8d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
export function isValidPublicationID( publicationID ) {
return (
typeof publicationID === 'string' &&
/^[A-Za-z0-9_-]+$/.test( publicationID )
/^[a-zA-Z0-9_-]+$/.test( publicationID )
);
}

Expand Down
2 changes: 1 addition & 1 deletion includes/Modules/Reader_Revenue_Manager/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function get_view_only_keys() {
protected function get_sanitize_callback() {
return function ( $option ) {
if ( isset( $option['publicationID'] ) ) {
if ( ! preg_match( '/^[a-zA-Z0-9]+$/', $option['publicationID'] ) ) {
if ( ! preg_match( '/^[a-zA-Z0-9_-]+$/', $option['publicationID'] ) ) {
$option['publicationID'] = '';
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public function test_view_only_keys() {

public function data_publication_settings() {
return array(
'publicationID is valid string' => array( 'publicationID', 'ABCD1234', 'ABCD1234' ),
'publicationID is valid string' => array( 'publicationID', 'ABCD_123-4', 'ABCD_123-4' ),
'publicationOnboardingState is valid string' => array( 'publicationOnboardingState', 'PENDING_VERIFICATION', 'PENDING_VERIFICATION' ),
'publicationOnboardingStateLastSyncedAtMs is valid' => array( 'publicationOnboardingStateLastSyncedAtMs', 0, 0 ),
'publicationID is invalid string' => array( 'publicationID', 'ABCD1234&^##', '' ),
'publicationID is invalid string' => array( 'publicationID', 'ABCD_123-4&^##', '' ),
'publicationOnboardingState is invalid string' => array( 'publicationOnboardingState', 'INVALID_STATE', '' ),
'publicationOnboardingStateLastSyncedAtMs is invalid' => array( 'publicationOnboardingStateLastSyncedAtMs', 0.87686, 0 ),
);
Expand Down

0 comments on commit 9348f8d

Please sign in to comment.