| @@ -1,0 +1,25 @@ | ||
| 1 | +<?php | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; // Exit if accessed directly. | |
| 4 | +} | |
| 5 | + | |
| 6 | +$label = str_pad( esc_html__( 'Label', 'ablocks' ), 20, ' ' ); // Prepare raw string first. | |
| 7 | +$value = esc_html__( 'Value', 'ablocks' ); | |
| 8 | + | |
| 9 | +echo "\n\n\n" . esc_html( $label . $value ) . "\n"; | |
| 10 | +echo "-------------------------------------\n"; | |
| 11 | + | |
| 12 | +// Ensure $data is an array to avoid errors | |
| 13 | +if ( ! empty( $data ) && is_array( $data ) ) { | |
| 14 | + foreach ( $data as $input_id => $attr ) { | |
| 15 | + $attr = apply_filters( 'ablocks/form_email_field', $attr, $input_id ); | |
| 16 | + $label_text = ucfirst( preg_replace( '/[_-]/m', ' ', $input_id ) ); | |
| 17 | + $label = str_pad( esc_html( $label_text ), 18, ' ' ); | |
| 18 | + $value = isset( $attr['value'] ) ? ( | |
| 19 | + ( is_iterable( $attr['value'] ) ? wp_kses_post( implode( ', S', $attr['value'] ) ) : \wp_kses_post( $attr['value'] ) ) | |
| 20 | + ) : ''; | |
| 21 | + | |
| 22 | + // Output the formatted label and value | |
| 23 | + echo esc_html( $label . ': ' . $value ) . "\n"; | |
| 24 | + } | |
| 25 | +} | |