Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #39 issue with transient data displaying in admin #40

Merged
merged 1 commit into from
Oct 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions includes/admin/class-dfm-transient-meta-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,32 @@ public function render_transient_list( $object ) {

echo '<table class="widefat striped">';
echo '<thead>';
echo '<td>' . esc_html__( 'Transient Key', 'dfm-transients' ) . '</td>';
echo '<td>' . esc_html__( 'Value', 'dfm-transients' ) . '</td>';
echo '<td>' . esc_html__( 'Expiration', 'dfm-transients' ) . '</td>';
echo '<td>' . esc_html__( 'Transient Key', 'dfm-transients' ) . '</td>';
echo '<td>' . esc_html__( 'Value', 'dfm-transients' ) . '</td>';
echo '<td>' . esc_html__( 'Expiration', 'dfm-transients' ) . '</td>';
echo '</thead>';
foreach ( $transients as $transient_key => $transient_value ) {
$data = maybe_unserialize( $transient_value[0] );
echo '<tr>';
echo '<td>' . esc_html( $transient_key ) . '</td>';
if ( is_array( $data ) && array_key_exists( 'data', $data ) && ! empty( $data['expiration'] ) ) {
echo '<td><textarea cols="50" disabled>' . esc_html( $data['data'] ) . '</textarea></td>';
echo '<td>' . esc_html( date( 'm-d-y H:i:s', $data['expiration'] ) ) . '</td>';

$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 '<td><textarea cols="50" disabled>' . esc_html( $data ) . '</textarea></td>';
echo '<td></td>';
$data = $transient_value;
$expiration = '';
}

$data = var_export( $data, true );

echo '<tr>';
echo '<td>' . esc_html( $transient_key ) . '</td>';
echo '<td><textarea cols="50" disabled>' . esc_html( $data ) . '</textarea></td>';
echo '<td>' . esc_html( $expiration ) . '</td>';
echo '</tr>';

}

echo '</table>';

}
Expand Down