forked from blallo/rss-bridge
[Bridge] Fix invalid text value without pattern
This commit is contained in:
parent
47b6cb8937
commit
1aa01a1f67
1 changed files with 7 additions and 3 deletions
|
@ -143,8 +143,8 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
return $this->items;
|
return $this->items;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function isValidTextValue($value, $pattern){
|
protected function isValidTextValue($value, $pattern = null){
|
||||||
if(isset($pattern)){
|
if(!is_null($pattern)){
|
||||||
$filteredValue = filter_var($value, FILTER_VALIDATE_REGEXP,
|
$filteredValue = filter_var($value, FILTER_VALIDATE_REGEXP,
|
||||||
array('options' => array(
|
array('options' => array(
|
||||||
'regexp' => '/^' . $pattern . '$/'
|
'regexp' => '/^' . $pattern . '$/'
|
||||||
|
@ -221,7 +221,11 @@ abstract class BridgeAbstract implements BridgeInterface {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case 'text':
|
case 'text':
|
||||||
|
if(isset($set[$name]['pattern'])){
|
||||||
$data[$name] = $this->isValidTextValue($value, $set[$name]['pattern']);
|
$data[$name] = $this->isValidTextValue($value, $set[$name]['pattern']);
|
||||||
|
} else {
|
||||||
|
$data[$name] = $this->isValidTextValue($value);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue