PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / trunk
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution vtrunk
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
← All changes | app/Services/ConditionAssesor.php +24 -24 1.5.21trunk View file →
@@ -40,73 +40,73 @@
40 40
41 41 public static function assess(&$conditional, &$inputs)
42 42 {
43 43 if ($conditional['field']) {
44 - $inputValue = Arr::get($inputs, $conditional['field']);
44 + $inputValue = Arr::get($inputs, $conditional['field'], '');
45 + $conditionValue = Arr::get($conditional, 'value', '');
46 + $stringInputValue = is_scalar($inputValue) ? (string) $inputValue : '';
47 + $stringConditionValue = is_scalar($conditionValue) ? (string) $conditionValue : '';
45 48
46 49 switch ($conditional['operator']) {
47 50 case '=':
48 51 if(is_array($inputValue)) {
49 - return in_array($conditional['value'], $inputValue);
52 + return in_array($conditionValue, $inputValue);
50 53 }
51 - return $inputValue == $conditional['value'];
54 + return $inputValue == $conditionValue;
52 55 break;
53 56 case '!=':
54 57 if(is_array($inputValue)) {
55 - return !in_array($conditional['value'], $inputValue);
58 + return !in_array($conditionValue, $inputValue);
56 59 }
57 - return $inputValue != $conditional['value'];
60 + return $inputValue != $conditionValue;
58 61 break;
59 62 case '>':
60 - return $inputValue > $conditional['value'];
63 + return $inputValue > $conditionValue;
61 64 break;
62 65 case '<':
63 - return $inputValue < $conditional['value'];
66 + return $inputValue < $conditionValue;
64 67 break;
65 68 case '>=':
66 - return $inputValue >= $conditional['value'];
69 + return $inputValue >= $conditionValue;
67 70 break;
68 71 case '<=':
69 - return $inputValue <= $conditional['value'];
72 + return $inputValue <= $conditionValue;
70 73 break;
71 74 case 'startsWith':
72 - return Str::startsWith($inputValue, $conditional['value']);
75 + return Str::startsWith($stringInputValue, $stringConditionValue);
73 76 break;
74 77 case 'endsWith':
75 - return Str::endsWith($inputValue, $conditional['value']);
78 + return Str::endsWith($stringInputValue, $stringConditionValue);
76 79 break;
77 80 case 'contains':
78 - return Str::contains($inputValue, $conditional['value']);
81 + return Str::contains($stringInputValue, $stringConditionValue);
79 82 break;
80 83 case 'doNotContains':
81 - return !Str::contains($inputValue, $conditional['value']);
84 + return !Str::contains($stringInputValue, $stringConditionValue);
82 85 break;
83 86 case 'length_equal':
84 87 if(is_array($inputValue)) {
85 - return count($inputValue) == $conditional['value'];
88 + return count($inputValue) == $conditionValue;
86 89 }
87 - $inputValue = strval($inputValue);
88 - return strlen($inputValue) == $conditional['value'];
90 + return strlen($stringInputValue) == $conditionValue;
89 91 break;
90 92 case 'length_less_than':
91 93 if(is_array($inputValue)) {
92 - return count($inputValue) < $conditional['value'];
94 + return count($inputValue) < $conditionValue;
93 95 }
94 - $inputValue = strval($inputValue);
95 - return strlen($inputValue) < $conditional['value'];
96 + return strlen($stringInputValue) < $conditionValue;
96 97 break;
97 98 case 'length_greater_than':
98 99 if(is_array($inputValue)) {
99 - return count($inputValue) > $conditional['value'];
100 + return count($inputValue) > $conditionValue;
100 101 }
101 - $inputValue = strval($inputValue);
102 - return strlen($inputValue) > $conditional['value'];
102 + return strlen($stringInputValue) > $conditionValue;
103 103 break;
104 104 case 'test_regex':
105 105 if(is_array($inputValue)) {
106 - $inputValue = implode(' ', $inputValue);
106 + $stringInputValue = implode(' ', $inputValue);
107 107 }
108 - $result = preg_match('/'.$conditional['value'].'/', $inputValue);
108 + $result = preg_match('/'.$stringConditionValue.'/', $stringInputValue);
109 109 return !!$result;
110 110 break;
111 111 }
112 112 }