html-webhook-log.php 1.68 KB
Newer Older
imac's avatar
imac committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

?>

<tr>
	<td><?php echo date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $log['comment']->comment_date_gmt ), true ); ?></td>
	<td><?php echo esc_attr( $log['request_url'] ); ?></td>
	<td>
		<p><strong><?php _e( 'Method', 'woocommerce' ); ?>: </strong><?php echo esc_html( $log['request_method'] ); ?></p>
		<p><strong><?php _e( 'Duration', 'woocommerce' ); ?>: </strong><?php echo esc_html( $log['duration'] ); ?></p>
		<p><strong><?php _e( 'Headers', 'woocommerce' ); ?>:</strong></p>
		<ul>
			<?php foreach ( (array) $log['request_headers'] as $key => $value ) : ?>
				<li><strong><em><?php echo strtolower( esc_html( $key ) ); ?>: </em></strong><code><?php echo esc_html( $value ); ?></code></li>
			<?php endforeach ?>
		</ul>
		<p><strong><?php _e( 'Content', 'woocommerce' ); ?>: </strong></p>
		<pre><code><?php echo esc_html( $log['request_body'] ); ?></code></pre>
	</td>
	<td>
		<p><strong><?php _e( 'Status', 'woocommerce' ); ?>: </strong><?php echo esc_html( $log['summary'] ); ?></p>
		<p><strong><?php _e( 'Headers', 'woocommerce' ); ?>:</strong></p>
		<ul>
			<?php $response_headers = is_callable( array( $log['response_headers'], 'getAll' ) ) ? $log['response_headers']->getAll() : $log['response_headers']; ?>
			<?php foreach ( (array) $response_headers as $key => $value ) : ?>
				<li><strong><em><?php echo strtolower( esc_html( $key ) ); ?>: </em></strong><code><?php echo esc_html( $value ); ?></code></li>
			<?php endforeach ?>
		</ul>
		<?php if ( ! empty( $log['response_body'] ) ) : ?>
			<h4><?php _e( 'Content', 'woocommerce' ); ?>:</h4>
			<p><?php echo esc_html( $log['response_body'] ); ?></p>
		<?php endif; ?>
	</td>
</tr>