<?php
$messages = $form_options['messages'];
foreach ( $messages as $key => $message ):
$elid = str_replace( '-', '_', $key );
$content = apply_filters( 'wpmtst_l10n', $message['text'], wpmtst_get_l10n_context( 'form-messages' ), $key . ' : text' );
?>
<tr>
<th scope="row">
<label for="<?php echo $elid; ?>">
<?php _ex( $message['description'], 'description', 'strong-testimonials' ); ?>
</label>
<input type="hidden" name="wpmtst_form_options[messages][<?php echo $key; ?>][description]"
value="<?php esc_attr_e( $message['description'] ); ?>"/>
</th>
<td>
<?php if ( 'submission_success' == $elid ): ?>
<?php
$settings = array(
'textarea_name' => "wpmtst_form_options[messages][$key][text]",
'textarea_rows' => 10,
);
wp_editor( $content, $elid, $settings );
?>
<?php else: ?>
<input type="text" id="<?php echo $elid; ?>"
name="wpmtst_form_options[messages][<?php echo $key; ?>][text]"
value="<?php echo esc_attr( $content ); ?>" required />
<?php endif; ?>
</td>
<td class="actions">
<input type="button" class="button secondary restore-default-message"
value="<?php _ex( 'restore default', 'singular', 'strong-testimonials' ); ?>"
data-target-id="<?php echo $elid; ?>"/>
</td>
</tr>
<?php endforeach; ?>
Помогите решить проблему. В начале есть цикл foreach. И вроде в новой версии PHP нужно его завернуть в if ( is_array( $messages) ) { код }. Но что-то не получается. Во-первых, для foreach нет скобочек, есть двоеточие и я не пойму как именно "завернуть" этот код.