From 03f81a163f968f7a8ef96c75efb64d35bf31fdee Mon Sep 17 00:00:00 2001 From: Ryan Kanner Date: Mon, 9 Oct 2017 15:36:39 -0600 Subject: [PATCH] fixes #39 issue with transient data displaying in admin --- .../admin/class-dfm-transient-meta-ui.php | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/includes/admin/class-dfm-transient-meta-ui.php b/includes/admin/class-dfm-transient-meta-ui.php index b888491..0f0aa0e 100644 --- a/includes/admin/class-dfm-transient-meta-ui.php +++ b/includes/admin/class-dfm-transient-meta-ui.php @@ -98,23 +98,32 @@ public function render_transient_list( $object ) { echo ''; echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; echo ''; foreach ( $transients as $transient_key => $transient_value ) { - $data = maybe_unserialize( $transient_value[0] ); - echo ''; - echo ''; - if ( is_array( $data ) && array_key_exists( 'data', $data ) && ! empty( $data['expiration'] ) ) { - echo ''; - echo ''; + + $transient_value = maybe_unserialize( $transient_value[0] ); + + if ( array_key_exists( 'data', $transient_value ) ) { + $data = $transient_value['data']; + $expiration = date( 'm-d-y H:i:s', $transient_value['expiration'] ); } else { - echo ''; - echo ''; + $data = $transient_value; + $expiration = ''; } + + $data = var_export( $data, true ); + + echo ''; + echo ''; + echo ''; + echo ''; echo ''; + } + echo '
' . esc_html__( 'Transient Key', 'dfm-transients' ) . '' . esc_html__( 'Value', 'dfm-transients' ) . '' . esc_html__( 'Expiration', 'dfm-transients' ) . '' . esc_html__( 'Transient Key', 'dfm-transients' ) . '' . esc_html__( 'Value', 'dfm-transients' ) . '' . esc_html__( 'Expiration', 'dfm-transients' ) . '
' . esc_html( $transient_key ) . '' . esc_html( date( 'm-d-y H:i:s', $data['expiration'] ) ) . '
' . esc_html( $transient_key ) . '' . esc_html( $expiration ) . '
'; }