| @@ -21,8 +21,12 @@ | ||
| 21 | 21 | 'key' => $fieldKey, |
| 22 | 22 | 'value' => $value, |
| 23 | 23 | 'type' => $fieldDetail->typ, |
| 24 | 24 | ]; |
| 25 | + if ('advanced-datetime' === $fieldData[$fieldKey]['type']) { | |
| 26 | + // Date conditions must parse the posted value in the field's own format. | |
| 27 | + $fieldData[$fieldKey]['dateFormat'] = DateConditionComparator::advancedValueFormat(isset($fieldDetail->config) ? $fieldDetail->config : null); | |
| 28 | + } | |
| 25 | 29 | if (isset($fieldDetail->mul)) { |
| 26 | 30 | $fieldData[$fieldKey] = |
| 27 | 31 | array_merge( |
| 28 | 32 | $fieldData[$fieldKey], |
| @@ -30,8 +34,13 @@ | ||
| 30 | 34 | 'mul' => $fieldDetail->mul, |
| 31 | 35 | ] |
| 32 | 36 | ); |
| 33 | 37 | } |
| 38 | + // A multiple-choice Image Select holds a list, like a checkbox; compared as one string | |
| 39 | + // only its last choice counted. | |
| 40 | + if ('image-select' === $fieldDetail->typ && isset($fieldDetail->inpType) && 'checkbox' === $fieldDetail->inpType) { | |
| 41 | + $fieldData[$fieldKey]['mul'] = true; | |
| 42 | + } | |
| 34 | 43 | } |
| 35 | 44 | return $fieldData; |
| 36 | 45 | } |
| 37 | 46 | |
| @@ -88,9 +97,16 @@ | ||
| 88 | 97 | || isset($conditionalActionIds['successMsg'][(string) $msg->id]) |
| 89 | 98 | ) { |
| 90 | 99 | continue; |
| 91 | 100 | } |
| 92 | - $returnableData = self::replaceFieldWithValue($msg->message_content, $fieldValue, true, null, true); | |
| 101 | + // Translate before smart-tag replacement (identity when unhooked). | |
| 102 | + $messageContent = (string) apply_filters( | |
| 103 | + 'bitform_translate_form_string', | |
| 104 | + (string) $msg->message_content, | |
| 105 | + 'msg-content-' . $msg->id, | |
| 106 | + $formId | |
| 107 | + ); | |
| 108 | + $returnableData = self::replaceFieldWithValue($messageContent, $fieldValue, true, null, true); | |
| 93 | 109 | $messageId = $msg->id; |
| 94 | 110 | if (isset($msgConfig->afterSubmit)) { |
| 95 | 111 | $afterSubmit = $msgConfig->afterSubmit; |
| 96 | 112 | } |
| @@ -109,8 +125,15 @@ | ||
| 109 | 125 | continue; |
| 110 | 126 | } |
| 111 | 127 | $url = Utilities::jsonObj($redirectPage->integration_details ?? '')->url ?? ''; |
| 112 | 128 | if (!empty($url)) { |
| 129 | + // Translated before smart-tag replacement: per-language redirect targets. | |
| 130 | + $url = (string) apply_filters( | |
| 131 | + 'bitform_translate_form_string', | |
| 132 | + (string) $url, | |
| 133 | + 'redirect-url-' . $redirectPage->id, | |
| 134 | + $formId | |
| 135 | + ); | |
| 113 | 136 | $url = self::replaceFieldWithValue($url, $fieldValue); |
| 114 | 137 | } |
| 115 | 138 | $returnableData = empty($url) ? '' : esc_url_raw($url); |
| 116 | 139 | break; |
| @@ -484,9 +507,11 @@ | ||
| 484 | 507 | return $firstOperand - $secondOperand; |
| 485 | 508 | case '*': |
| 486 | 509 | return $firstOperand * $secondOperand; |
| 487 | 510 | case '/': |
| 488 | - return 0 == $secondOperand ? null : $firstOperand / $secondOperand; | |
| 511 | + // Compare as float, not with `0 ==`: PHP 8 made `0 == ''` false, so a | |
| 512 | + // non-numeric operand slipped past the old guard into DivisionByZeroError. | |
| 513 | + return 0.0 === (float) $secondOperand ? null : $firstOperand / $secondOperand; | |
| 489 | 514 | case '^': |
| 490 | 515 | return $firstOperand ** $secondOperand; |
| 491 | 516 | } |
| 492 | 517 | |