Skip to content

Commit

Permalink
WPCIVIUX-176 Fix validator criteria and remove exception
Browse files Browse the repository at this point in the history
  • Loading branch information
agileware-iris committed Nov 7, 2024
1 parent af47003 commit 714f724
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion civicrm-ux.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Plugin Name: WP CiviCRM UX
* Plugin URI: https://github.com/agileware/wp-civicrm-ux
* Description: A better user experience for integrating WordPress and CiviCRM
* Version: 1.20.2
* Version: 1.20.3
* Requires at least: 5.8
* Requires PHP: 7.4
* Requires Plugins: civicrm
Expand Down
5 changes: 3 additions & 2 deletions includes/utils/class-civicrm-ux-validators.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ public static function validateCssColor($color): ?string

public static function validateAPIFieldName($field, $key = null): ?string
{
$valid = preg_match('{ ^ (?! [.-] ) [[:alnum:]._-]+ (?<! [._-]) $ }xi', $field, $matches);
$valid = preg_match('{ ^ (?! [.-] ) [[:alnum:]._:-]+ (?<! [._-]) $ }xi', $field, $matches);

if (!$valid) {
throw new InvalidArgumentException($key ? __('Invalid field key given') : sprintf(__('Invalid key given for "%1$s"'), $key));
error_log( $key ? __('Invalid field key given') : sprintf(__('Invalid key given for "%1$s"' )));
return null;
}

return $matches[0];
Expand Down

0 comments on commit 714f724

Please sign in to comment.