Skip to content
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
15 changes: 8 additions & 7 deletions post-meta-inspector.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // phpcs:ignore
<?php
/**
* Plugin Name: Post Meta Inspector
* Plugin URI: http://wordpress.org/extend/plugins/post-meta-inspector/
Expand Down Expand Up @@ -92,7 +92,7 @@ public function action_add_meta_boxes() {
public function post_meta_inspector() {
$toggle_length = apply_filters( 'pmi_toggle_long_value_length', 0 );
$toggle_length = max( intval( $toggle_length ), 0 );
$toggle_el = '<a href="javascript:void(0);" class="pmi_toggle">' . __( 'Click to show&hellip;', 'post-meta-inspector' ) . '</a>';
$toggle_el = '<a href="javascript:void(0);" class="pmi_toggle">' . esc_html__( 'Click to show&hellip;', 'post-meta-inspector' ) . '</a>';
?>
<style>
#post-meta-inspector table {
Expand All @@ -116,8 +116,8 @@ public function post_meta_inspector() {
<table>
<thead>
<tr>
<th class="key-column"><?php _e( 'Key', 'post-meta-inspector' ); // phpcs:ignore ?></th>
<th class="value-column"><?php _e( 'Value', 'post-meta-inspector' ); // phpcs:ignore ?></th>
<th class="key-column"><?php esc_html_e( 'Key', 'post-meta-inspector' ); ?></th>
<th class="value-column"><?php esc_html_e( 'Value', 'post-meta-inspector' ); ?></th>
</tr>
</thead>
<tbody>
Expand All @@ -129,21 +129,22 @@ public function post_meta_inspector() {
?>
<?php foreach ( $values as $value ) : ?>
<?php
$value = var_export( $value, true ); // phpcs:ignore
$value = var_export( $value, true );
$toggled = $toggle_length && strlen( $value ) > $toggle_length;
?>
<tr>
<td class="key-column"><?php echo esc_html( $key ); ?></td>
<td class="value-column">
<?php
if ( $toggled ) {
echo $toggle_el; // phpcs:ignore
echo $toggle_el; // phpcs:ignore -- escaped earlier
}
?>
<code
<?php
if ( $toggled ) {
echo ' style="display: none;"';}
echo ' style="display: none;"';
}
?>
>
<?php echo esc_html( $value ); ?>
Expand Down