Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/wpforms-.../src/Frontend
File: Frontend.php
'required' => ! empty( $field['required'] ) ? 'required' : '',
[1000] Fix | Delete
],
[1001] Fix | Delete
],
[1002] Fix | Delete
'error' => [
[1003] Fix | Delete
'attr' => [
[1004] Fix | Delete
'for' => sprintf( self::FIELD_FORMAT, $form_id, $field_id ),
[1005] Fix | Delete
],
[1006] Fix | Delete
'class' => [ 'wpforms-error' ],
[1007] Fix | Delete
'data' => [],
[1008] Fix | Delete
'id' => '',
[1009] Fix | Delete
'value' => $error,
[1010] Fix | Delete
],
[1011] Fix | Delete
'description' => [
[1012] Fix | Delete
'attr' => [],
[1013] Fix | Delete
'class' => $attributes['description_class'],
[1014] Fix | Delete
'data' => [],
[1015] Fix | Delete
'id' => implode( '', array_slice( $attributes['description_id'], 0 ) ),
[1016] Fix | Delete
'position' => 'after',
[1017] Fix | Delete
'value' => ! empty( $field['description'] ) ? wpforms_process_smart_tags( $field['description'], $form_data, [], '', 'field-properties' ) : '',
[1018] Fix | Delete
],
[1019] Fix | Delete
];
[1020] Fix | Delete
[1021] Fix | Delete
// phpcs:disable WPForms.PHP.ValidateHooks.InvalidHookName
[1022] Fix | Delete
/**
[1023] Fix | Delete
* Filters field properties.
[1024] Fix | Delete
*
[1025] Fix | Delete
* @since 1.3.6.2
[1026] Fix | Delete
*
[1027] Fix | Delete
* @param array $properties Field properties.
[1028] Fix | Delete
* @param array $field Field data and settings.
[1029] Fix | Delete
* @param array $form_data Form data and settings.
[1030] Fix | Delete
*/
[1031] Fix | Delete
$properties = (array) apply_filters( "wpforms_field_properties_{$field['type']}", $properties, $field, $form_data );
[1032] Fix | Delete
[1033] Fix | Delete
/**
[1034] Fix | Delete
* Filters properties.
[1035] Fix | Delete
*
[1036] Fix | Delete
* @since 1.3.6.2
[1037] Fix | Delete
*
[1038] Fix | Delete
* @param array $properties Field properties.
[1039] Fix | Delete
* @param array $field Field data and settings.
[1040] Fix | Delete
* @param array $form_data Form data and settings.
[1041] Fix | Delete
*/
[1042] Fix | Delete
return (array) apply_filters( 'wpforms_field_properties', $properties, $field, $form_data );
[1043] Fix | Delete
// phpcs:enable WPForms.PHP.ValidateHooks.InvalidHookName
[1044] Fix | Delete
}
[1045] Fix | Delete
[1046] Fix | Delete
/**
[1047] Fix | Delete
* Prepare get_field_properties.
[1048] Fix | Delete
*
[1049] Fix | Delete
* @since 1.8.1
[1050] Fix | Delete
*
[1051] Fix | Delete
* @param array $field Field data and settings.
[1052] Fix | Delete
* @param array $form_data Form data and settings.
[1053] Fix | Delete
* @param array $attributes List of field attributes.
[1054] Fix | Delete
*
[1055] Fix | Delete
* @return array
[1056] Fix | Delete
*/
[1057] Fix | Delete
private function prepare_get_field_properties( array $field, array $form_data, array $attributes ): array {
[1058] Fix | Delete
[1059] Fix | Delete
$attributes = empty( $attributes ) ? $this->get_field_attributes( $field, $form_data ) : $attributes;
[1060] Fix | Delete
$field = $this->filter_field( $field, $form_data, $attributes );
[1061] Fix | Delete
$form_id = absint( $form_data['id'] );
[1062] Fix | Delete
$field_id = wpforms_validate_field_id( $field['id'] );
[1063] Fix | Delete
$error = ! empty( wpforms()->obj( 'process' )->errors[ $form_id ][ $field_id ] ) ? wpforms()->obj( 'process' )->errors[ $form_id ][ $field_id ] : '';
[1064] Fix | Delete
[1065] Fix | Delete
return [ $field, $attributes, $error ];
[1066] Fix | Delete
}
[1067] Fix | Delete
[1068] Fix | Delete
/**
[1069] Fix | Delete
* Filter field.
[1070] Fix | Delete
*
[1071] Fix | Delete
* @since 1.8.1
[1072] Fix | Delete
*
[1073] Fix | Delete
* @param array $field Field data and settings.
[1074] Fix | Delete
* @param array $form_data Form data and settings.
[1075] Fix | Delete
* @param array $attributes Field attributes.
[1076] Fix | Delete
*
[1077] Fix | Delete
* @return array
[1078] Fix | Delete
*/
[1079] Fix | Delete
private function filter_field( array $field, array $form_data, array $attributes ): array {
[1080] Fix | Delete
[1081] Fix | Delete
// This filter is for backwards compatibility purposes.
[1082] Fix | Delete
$types = [ 'text', 'textarea', 'name', 'number', 'email', 'hidden', 'url', 'html', 'divider', 'password', 'phone', 'address', 'select', 'checkbox', 'radio' ];
[1083] Fix | Delete
[1084] Fix | Delete
if ( in_array( $field['type'], $types, true ) ) {
[1085] Fix | Delete
// phpcs:disable WPForms.PHP.ValidateHooks.InvalidHookName
[1086] Fix | Delete
[1087] Fix | Delete
/**
[1088] Fix | Delete
* Filters field.
[1089] Fix | Delete
*
[1090] Fix | Delete
* @since 1.3.6.2
[1091] Fix | Delete
*
[1092] Fix | Delete
* @param array $field Field data and settings.
[1093] Fix | Delete
* @param array $attributes Field attributes.
[1094] Fix | Delete
* @param array $form_data Form data and settings.
[1095] Fix | Delete
*/
[1096] Fix | Delete
$filtered_field = apply_filters( "wpforms_{$field['type']}_field_display", $field, $attributes, $form_data );
[1097] Fix | Delete
$field = wpforms_list_intersect_key( (array) $filtered_field, $field );
[1098] Fix | Delete
} elseif ( $field['type'] === 'credit-card' ) {
[1099] Fix | Delete
[1100] Fix | Delete
/**
[1101] Fix | Delete
* Filters credit card field.
[1102] Fix | Delete
*
[1103] Fix | Delete
* @since 1.3.6.2
[1104] Fix | Delete
*
[1105] Fix | Delete
* @param array $field Field data and settings.
[1106] Fix | Delete
* @param array $attributes Field attributes.
[1107] Fix | Delete
* @param array $form_data Form data and settings.
[1108] Fix | Delete
*/
[1109] Fix | Delete
$filtered_field = apply_filters( 'wpforms_creditcard_field_display', $field, $attributes, $form_data );
[1110] Fix | Delete
$field = wpforms_list_intersect_key( (array) $filtered_field, $field );
[1111] Fix | Delete
} elseif ( in_array( $field['type'], [ 'payment-multiple', 'payment-single', 'payment-checkbox' ], true ) ) {
[1112] Fix | Delete
$filter_field_type = str_replace( '-', '_', $field['type'] );
[1113] Fix | Delete
[1114] Fix | Delete
/**
[1115] Fix | Delete
* Filters payment field.
[1116] Fix | Delete
*
[1117] Fix | Delete
* @since 1.3.6.2
[1118] Fix | Delete
*
[1119] Fix | Delete
* @param array $field Field data and settings.
[1120] Fix | Delete
* @param array $attributes Field attributes.
[1121] Fix | Delete
* @param array $form_data Form data and settings.
[1122] Fix | Delete
*/
[1123] Fix | Delete
$filtered_field = apply_filters( 'wpforms_' . $filter_field_type . '_field_display', $field, $attributes, $form_data );
[1124] Fix | Delete
$field = wpforms_list_intersect_key( (array) $filtered_field, $field );
[1125] Fix | Delete
// phpcs:enable WPForms.PHP.ValidateHooks.InvalidHookName
[1126] Fix | Delete
}
[1127] Fix | Delete
[1128] Fix | Delete
return $field;
[1129] Fix | Delete
}
[1130] Fix | Delete
[1131] Fix | Delete
/**
[1132] Fix | Delete
* Field container open.
[1133] Fix | Delete
*
[1134] Fix | Delete
* @since 1.8.1
[1135] Fix | Delete
*
[1136] Fix | Delete
* @param array $field Field data and settings.
[1137] Fix | Delete
* @param array $form_data Form data and settings.
[1138] Fix | Delete
*/
[1139] Fix | Delete
public function field_container_open( $field, $form_data ): void {
[1140] Fix | Delete
[1141] Fix | Delete
$this->render_obj->field_container_open( $field, $form_data );
[1142] Fix | Delete
}
[1143] Fix | Delete
[1144] Fix | Delete
/**
[1145] Fix | Delete
* Field container close.
[1146] Fix | Delete
*
[1147] Fix | Delete
* @since 1.8.1
[1148] Fix | Delete
*
[1149] Fix | Delete
* @param array $field Field data and settings.
[1150] Fix | Delete
* @param array $form_data Form data and settings.
[1151] Fix | Delete
*/
[1152] Fix | Delete
public function field_container_close( $field, $form_data ): void {
[1153] Fix | Delete
[1154] Fix | Delete
$this->render_obj->field_container_close( $field, $form_data );
[1155] Fix | Delete
}
[1156] Fix | Delete
[1157] Fix | Delete
/**
[1158] Fix | Delete
* Field fieldset open.
[1159] Fix | Delete
*
[1160] Fix | Delete
* @since 1.8.1
[1161] Fix | Delete
*
[1162] Fix | Delete
* @param array $field Field data and settings.
[1163] Fix | Delete
* @param array $form_data Form data and settings.
[1164] Fix | Delete
*/
[1165] Fix | Delete
public function field_fieldset_open( $field, $form_data ): void {
[1166] Fix | Delete
[1167] Fix | Delete
$this->render_obj->field_fieldset_open( $field, $form_data );
[1168] Fix | Delete
}
[1169] Fix | Delete
[1170] Fix | Delete
/**
[1171] Fix | Delete
* Field fieldset close.
[1172] Fix | Delete
*
[1173] Fix | Delete
* @since 1.8.1
[1174] Fix | Delete
*
[1175] Fix | Delete
* @param array $field Field data and settings.
[1176] Fix | Delete
* @param array $form_data Form data and settings.
[1177] Fix | Delete
*/
[1178] Fix | Delete
public function field_fieldset_close( $field, $form_data ): void {
[1179] Fix | Delete
[1180] Fix | Delete
$this->render_obj->field_fieldset_close( $field, $form_data );
[1181] Fix | Delete
}
[1182] Fix | Delete
[1183] Fix | Delete
/**
[1184] Fix | Delete
* Display the label for each field.
[1185] Fix | Delete
*
[1186] Fix | Delete
* @since 1.8.1
[1187] Fix | Delete
*
[1188] Fix | Delete
* @param array $field Field data and settings.
[1189] Fix | Delete
* @param array $form_data Form data and settings.
[1190] Fix | Delete
*/
[1191] Fix | Delete
public function field_label( $field, $form_data ): void {
[1192] Fix | Delete
[1193] Fix | Delete
$label = $field['properties']['label'];
[1194] Fix | Delete
[1195] Fix | Delete
// If the label is empty or disabled, don't proceed.
[1196] Fix | Delete
if ( empty( $label['value'] ) || $label['disabled'] ) {
[1197] Fix | Delete
return;
[1198] Fix | Delete
}
[1199] Fix | Delete
[1200] Fix | Delete
$this->render_obj->field_label( $field, $form_data );
[1201] Fix | Delete
}
[1202] Fix | Delete
[1203] Fix | Delete
/**
[1204] Fix | Delete
* Display any errors for each field.
[1205] Fix | Delete
*
[1206] Fix | Delete
* @since 1.8.1
[1207] Fix | Delete
*
[1208] Fix | Delete
* @param array $field Field data and settings.
[1209] Fix | Delete
* @param array $form_data Form data and settings.
[1210] Fix | Delete
*/
[1211] Fix | Delete
public function field_error( $field, $form_data ): void {
[1212] Fix | Delete
[1213] Fix | Delete
$error = $field['properties']['error'];
[1214] Fix | Delete
[1215] Fix | Delete
// If there are no errors, don't proceed.
[1216] Fix | Delete
// Advanced fields with multiple inputs (address, name, etc.) errors
[1217] Fix | Delete
// will be an array and are handled within the respective field class.
[1218] Fix | Delete
if ( empty( $error['value'] ) || is_array( $error['value'] ) ) {
[1219] Fix | Delete
return;
[1220] Fix | Delete
}
[1221] Fix | Delete
[1222] Fix | Delete
$this->render_obj->field_error( $field, $form_data );
[1223] Fix | Delete
}
[1224] Fix | Delete
[1225] Fix | Delete
/**
[1226] Fix | Delete
* Display the description for each field.
[1227] Fix | Delete
*
[1228] Fix | Delete
* @since 1.8.1
[1229] Fix | Delete
*
[1230] Fix | Delete
* @param array $field Field data and settings.
[1231] Fix | Delete
* @param array $form_data Form data and settings.
[1232] Fix | Delete
*
[1233] Fix | Delete
* @noinspection HtmlUnknownAttribute
[1234] Fix | Delete
* @noinspection PhpUnusedParameterInspection
[1235] Fix | Delete
*/
[1236] Fix | Delete
public function field_description( $field, $form_data ): void {
[1237] Fix | Delete
[1238] Fix | Delete
$action = current_action();
[1239] Fix | Delete
$description = $field['properties']['description'];
[1240] Fix | Delete
[1241] Fix | Delete
// If the description is empty, don't proceed.
[1242] Fix | Delete
if ( empty( $description['value'] ) ) {
[1243] Fix | Delete
return;
[1244] Fix | Delete
}
[1245] Fix | Delete
[1246] Fix | Delete
// Determine positioning.
[1247] Fix | Delete
if ( $action === 'wpforms_display_field_before' && $description['position'] !== 'before' ) {
[1248] Fix | Delete
return;
[1249] Fix | Delete
}
[1250] Fix | Delete
[1251] Fix | Delete
if ( $action === 'wpforms_display_field_after' && $description['position'] !== 'after' ) {
[1252] Fix | Delete
return;
[1253] Fix | Delete
}
[1254] Fix | Delete
[1255] Fix | Delete
if ( $description['position'] === 'before' ) {
[1256] Fix | Delete
$description['class'][] = 'before';
[1257] Fix | Delete
}
[1258] Fix | Delete
[1259] Fix | Delete
$this->render_obj->field_description( $field, $form_data );
[1260] Fix | Delete
}
[1261] Fix | Delete
[1262] Fix | Delete
/**
[1263] Fix | Delete
* Anti-spam honeypot output if configured.
[1264] Fix | Delete
*
[1265] Fix | Delete
* @since 1.8.1
[1266] Fix | Delete
*
[1267] Fix | Delete
* @param array $form_data Form data and settings.
[1268] Fix | Delete
* @param null $deprecated Deprecated in v1.3.7, previously was $form object.
[1269] Fix | Delete
* @param bool $title Whether to display form title.
[1270] Fix | Delete
* @param bool $description Whether to display form description.
[1271] Fix | Delete
* @param array $errors List of all errors filled in WPForms_Process::process().
[1272] Fix | Delete
*
[1273] Fix | Delete
* @noinspection PhpUnusedParameterInspection
[1274] Fix | Delete
*/
[1275] Fix | Delete
public function honeypot( $form_data, $deprecated, $title, $description, $errors ): void { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
[1276] Fix | Delete
[1277] Fix | Delete
if (
[1278] Fix | Delete
empty( $form_data['settings']['honeypot'] ) ||
[1279] Fix | Delete
$form_data['settings']['honeypot'] !== '1'
[1280] Fix | Delete
) {
[1281] Fix | Delete
return;
[1282] Fix | Delete
}
[1283] Fix | Delete
[1284] Fix | Delete
$names = [ 'Name', 'Phone', 'Comment', 'Message', 'Email', 'Website' ];
[1285] Fix | Delete
[1286] Fix | Delete
echo '<div class="wpforms-field wpforms-field-hp">';
[1287] Fix | Delete
[1288] Fix | Delete
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
[1289] Fix | Delete
echo '<label for="wpforms-' . $form_data['id'] . '-field-hp" class="wpforms-field-label">' . $names[ array_rand( $names ) ] . '</label>';
[1290] Fix | Delete
[1291] Fix | Delete
echo '<input type="text" name="wpforms[hp]" id="wpforms-' . $form_data['id'] . '-field-hp" class="wpforms-field-medium">';
[1292] Fix | Delete
// phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped
[1293] Fix | Delete
[1294] Fix | Delete
echo '</div>';
[1295] Fix | Delete
}
[1296] Fix | Delete
[1297] Fix | Delete
/**
[1298] Fix | Delete
* Form footer area.
[1299] Fix | Delete
*
[1300] Fix | Delete
* @since 1.8.1
[1301] Fix | Delete
*
[1302] Fix | Delete
* @param array $form_data Form data and settings.
[1303] Fix | Delete
* @param null $deprecated Deprecated in v1.3.7, previously was $form object.
[1304] Fix | Delete
* @param bool $title Whether to display form title.
[1305] Fix | Delete
* @param bool $description Whether to display form description.
[1306] Fix | Delete
* @param array $errors List of all errors filled in WPForms_Process::process().
[1307] Fix | Delete
*
[1308] Fix | Delete
* @noinspection HtmlUnknownTarget
[1309] Fix | Delete
* @noinspection HtmlUnknownAttribute
[1310] Fix | Delete
* @noinspection PhpUnusedParameterInspection
[1311] Fix | Delete
*/
[1312] Fix | Delete
public function foot( $form_data, $deprecated, $title, $description, $errors ): void {
[1313] Fix | Delete
[1314] Fix | Delete
// Do not render footer if there are no fields on the front.
[1315] Fix | Delete
if ( empty( $this->rendered_fields ) ) {
[1316] Fix | Delete
return;
[1317] Fix | Delete
}
[1318] Fix | Delete
[1319] Fix | Delete
$form_id = absint( $form_data['id'] );
[1320] Fix | Delete
$settings = $form_data['settings'];
[1321] Fix | Delete
$submit_text = ! empty( $settings['submit_text'] ) ? $settings['submit_text'] : __( 'Submit', 'wpforms-lite' );
[1322] Fix | Delete
[1323] Fix | Delete
/**
[1324] Fix | Delete
* Filter the form submit button text.
[1325] Fix | Delete
*
[1326] Fix | Delete
* @since 1.0.0
[1327] Fix | Delete
*
[1328] Fix | Delete
* @param string $submit_text Submit button text.
[1329] Fix | Delete
* @param array $form_data Form data.
[1330] Fix | Delete
*/
[1331] Fix | Delete
$submit = apply_filters( 'wpforms_field_submit', $submit_text, $form_data ); // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
[1332] Fix | Delete
[1333] Fix | Delete
$attrs = [
[1334] Fix | Delete
'aria-live' => 'assertive',
[1335] Fix | Delete
'value' => 'wpforms-submit',
[1336] Fix | Delete
];
[1337] Fix | Delete
$data_attrs = [];
[1338] Fix | Delete
[1339] Fix | Delete
/**
[1340] Fix | Delete
* Filter the form submit button classes.
[1341] Fix | Delete
*
[1342] Fix | Delete
* @since 1.7.5.3
[1343] Fix | Delete
*
[1344] Fix | Delete
* @param array $classes Button classes.
[1345] Fix | Delete
* @param array $form_data Form data.
[1346] Fix | Delete
*/
[1347] Fix | Delete
$classes = (array) apply_filters( 'wpforms_frontend_foot_submit_classes', [], $form_data );
[1348] Fix | Delete
[1349] Fix | Delete
// A lot of our frontend logic is dependent on this class, so we need to make sure it's present.
[1350] Fix | Delete
$classes = array_merge( $classes, [ 'wpforms-submit' ] );
[1351] Fix | Delete
[1352] Fix | Delete
[
[1353] Fix | Delete
$attrs,
[1354] Fix | Delete
$data_attrs,
[1355] Fix | Delete
$classes
[1356] Fix | Delete
] = $this->check_submit_settings( $settings, $form_id, $submit, $attrs, $data_attrs, $classes );
[1357] Fix | Delete
[1358] Fix | Delete
// AMP submit error template.
[1359] Fix | Delete
$this->amp_obj->output_error_template();
[1360] Fix | Delete
[1361] Fix | Delete
// Output footer errors if they exist.
[1362] Fix | Delete
if ( ! empty( $errors['footer'] ) ) {
[1363] Fix | Delete
$this->form_error( 'footer', $errors['footer'] );
[1364] Fix | Delete
}
[1365] Fix | Delete
[1366] Fix | Delete
// Submit button area.
[1367] Fix | Delete
$this->render_obj->submit_container_open( $this->pages, $form_data );
[1368] Fix | Delete
[1369] Fix | Delete
echo '<input type="hidden" name="wpforms[id]" value="' . absint( $form_id ) . '">';
[1370] Fix | Delete
[1371] Fix | Delete
if ( is_user_logged_in() ) {
[1372] Fix | Delete
?>
[1373] Fix | Delete
<input
[1374] Fix | Delete
type="hidden"
[1375] Fix | Delete
name="wpforms[nonce]"
[1376] Fix | Delete
value="<?php echo esc_attr( wp_create_nonce( "wpforms::form_{$form_id}" ) ); ?>"
[1377] Fix | Delete
/>
[1378] Fix | Delete
<?php
[1379] Fix | Delete
}
[1380] Fix | Delete
[1381] Fix | Delete
echo '<input type="hidden" name="page_title" value="' . esc_attr( wpforms_process_smart_tags( '{page_title}', [], [], '', 'frontend-foot-hidden-input' ) ) . '">';
[1382] Fix | Delete
echo '<input type="hidden" name="page_url" value="' . esc_url( wpforms_process_smart_tags( '{page_url}', [], [], '', 'frontend-foot-hidden-input' ) ) . '">';
[1383] Fix | Delete
echo '<input type="hidden" name="url_referer" value="' . esc_url( wpforms_process_smart_tags( '{url_referer}', [], [], '', 'frontend-foot-hidden-input' ) ) . '">';
[1384] Fix | Delete
[1385] Fix | Delete
if ( is_singular() ) {
[1386] Fix | Delete
// The field is used for some smart tags determination.
[1387] Fix | Delete
echo '<input type="hidden" name="page_id" value="' . absint( get_the_ID() ) . '">';
[1388] Fix | Delete
// The field is used for setting global $post during AJAX submissions.
[1389] Fix | Delete
echo '<input type="hidden" name="wpforms[post_id]" value="' . absint( get_the_ID() ) . '">';
[1390] Fix | Delete
}
[1391] Fix | Delete
[1392] Fix | Delete
/**
[1393] Fix | Delete
* Fires before 'submit' button.
[1394] Fix | Delete
*
[1395] Fix | Delete
* @since 1.3.6.2
[1396] Fix | Delete
*
[1397] Fix | Delete
* @param array $form_data Form data and settings.
[1398] Fix | Delete
*/
[1399] Fix | Delete
do_action( 'wpforms_display_submit_before', $form_data ); // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
[1400] Fix | Delete
[1401] Fix | Delete
$this->render_obj->submit_button( $form_id, $submit, $classes, $data_attrs, $attrs, $form_data );
[1402] Fix | Delete
[1403] Fix | Delete
if ( ! empty( $settings['ajax_submit'] ) && ! $this->amp_obj->is_amp() ) {
[1404] Fix | Delete
[1405] Fix | Delete
/**
[1406] Fix | Delete
* Filter submit spinner image src attribute.
[1407] Fix | Delete
*
[1408] Fix | Delete
* @since 1.5.4.1
[1409] Fix | Delete
* @deprecated 1.6.7.3
[1410] Fix | Delete
*
[1411] Fix | Delete
* @see This filter is documented in wp-includes/plugin.php
[1412] Fix | Delete
*/
[1413] Fix | Delete
$src = apply_filters_deprecated(
[1414] Fix | Delete
'wpforms_display_sumbit_spinner_src',
[1415] Fix | Delete
[
[1416] Fix | Delete
WPFORMS_PLUGIN_URL . 'assets/images/submit-spin.svg',
[1417] Fix | Delete
$form_data,
[1418] Fix | Delete
],
[1419] Fix | Delete
'1.6.7.3',
[1420] Fix | Delete
'wpforms_display_submit_spinner_src'
[1421] Fix | Delete
);
[1422] Fix | Delete
[1423] Fix | Delete
/**
[1424] Fix | Delete
* Filter submit spinner image src attribute.
[1425] Fix | Delete
*
[1426] Fix | Delete
* @since 1.6.7.3
[1427] Fix | Delete
*
[1428] Fix | Delete
* @param string $src Spinner image source.
[1429] Fix | Delete
* @param array $form_data Form data and settings.
[1430] Fix | Delete
*/
[1431] Fix | Delete
$src = apply_filters( // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
[1432] Fix | Delete
'wpforms_display_submit_spinner_src',
[1433] Fix | Delete
$src,
[1434] Fix | Delete
$form_data
[1435] Fix | Delete
);
[1436] Fix | Delete
[1437] Fix | Delete
$this->render_obj->submit_spinner( $src, $form_data );
[1438] Fix | Delete
}
[1439] Fix | Delete
[1440] Fix | Delete
/**
[1441] Fix | Delete
* Runs right after form Submit button rendering.
[1442] Fix | Delete
*
[1443] Fix | Delete
* @since 1.5.0
[1444] Fix | Delete
* @since 1.7.5 Added new parameter for detecting button type.
[1445] Fix | Delete
*
[1446] Fix | Delete
* @param array $form_data Form data.
[1447] Fix | Delete
* @param string $button Button type, e.g. `submit`, `next`.
[1448] Fix | Delete
*/
[1449] Fix | Delete
do_action( 'wpforms_display_submit_after', $form_data, 'submit' ); // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
[1450] Fix | Delete
[1451] Fix | Delete
$this->render_obj->submit_container_close( $form_data );
[1452] Fix | Delete
[1453] Fix | Delete
// Load the success template in AMP.
[1454] Fix | Delete
$this->amp_obj->output_success_template( $form_data );
[1455] Fix | Delete
}
[1456] Fix | Delete
[1457] Fix | Delete
/**
[1458] Fix | Delete
* Check submit settings and adjust attributes and classes.
[1459] Fix | Delete
*
[1460] Fix | Delete
* @since 1.8.1
[1461] Fix | Delete
*
[1462] Fix | Delete
* @param array $settings Settings.
[1463] Fix | Delete
* @param int $form_id Form id.
[1464] Fix | Delete
* @param string $submit Submit button text.
[1465] Fix | Delete
* @param array $attrs Attributes.
[1466] Fix | Delete
* @param array $data_attrs Data attributes.
[1467] Fix | Delete
* @param array $classes Classes.
[1468] Fix | Delete
*
[1469] Fix | Delete
* @return array
[1470] Fix | Delete
*/
[1471] Fix | Delete
private function check_submit_settings( $settings, $form_id, $submit, $attrs, $data_attrs, $classes ): array {
[1472] Fix | Delete
[1473] Fix | Delete
// Check for the 'submit' button alt-text.
[1474] Fix | Delete
if ( ! empty( $settings['submit_text_processing'] ) ) {
[1475] Fix | Delete
if ( $this->amp_obj->is_amp() ) {
[1476] Fix | Delete
$attrs['[text]'] = $this->amp_obj->get_text_attr( $form_id, $settings, $submit );
[1477] Fix | Delete
} else {
[1478] Fix | Delete
$data_attrs['alt-text'] = $settings['submit_text_processing'];
[1479] Fix | Delete
$data_attrs['submit-text'] = $submit;
[1480] Fix | Delete
}
[1481] Fix | Delete
}
[1482] Fix | Delete
[1483] Fix | Delete
// Check user defined submit button classes.
[1484] Fix | Delete
if ( ! empty( $settings['submit_class'] ) ) {
[1485] Fix | Delete
$submit_classes = is_array( $settings['submit_class'] ) ?
[1486] Fix | Delete
$settings['submit_class'] :
[1487] Fix | Delete
array_filter( explode( ' ', $settings['submit_class'] ) );
[1488] Fix | Delete
$classes = array_merge( $classes, $submit_classes );
[1489] Fix | Delete
}
[1490] Fix | Delete
[1491] Fix | Delete
return [ $attrs, $data_attrs, $classes ];
[1492] Fix | Delete
}
[1493] Fix | Delete
[1494] Fix | Delete
/**
[1495] Fix | Delete
* Display form error.
[1496] Fix | Delete
*
[1497] Fix | Delete
* @since 1.5.3
[1498] Fix | Delete
* @since 1.8.1 Added $form_data optional parameter.
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function