Skip to content

Commit

Permalink
Merge pull request #17 from Emilia-Capital/jdv/htmlentities-value
Browse files Browse the repository at this point in the history
Run htmlentities over plugin value to make it more easily copy pastable
  • Loading branch information
jdevalk authored Aug 20, 2024
2 parents 15b018f + 3720a61 commit 36f176c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ div.dt-container .dt-input {
max-width: 80%;
min-height: 200px;
max-height: 80%;
text-align: left;
}
.aaa-option-optimizer-popover pre {
padding: 10px;
Expand All @@ -62,7 +63,6 @@ div.dt-container .dt-input {
border: 1px solid #ccc;
background-color: #eee;
overflow: scroll;
text-align: left;
white-space: pre-wrap;
word-wrap: anywhere;
}
Expand Down
2 changes: 1 addition & 1 deletion src/class-admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ private function get_value_button( string $name, $value ): string {
<button class="aaa-option-optimizer-popover__close" popovertarget="' . $id . '" popovertargetaction="hide">X</button>' .
// translators: %s is the name of the option.
'<p><strong>' . sprintf( esc_html__( 'Value of %s', 'aaa-option-optimizer' ), '<code>' . esc_html( $name ) . '</code>' ) . '</strong></p>
<pre>' . esc_html( $string ) . '</pre>
<pre>' . htmlentities( $string, ENT_QUOTES | ENT_SUBSTITUTE ) . '</pre>
</div>';
}

Expand Down
2 changes: 1 addition & 1 deletion src/class-rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function get_all_options() {
$output[] = [
'name' => $option->option_name,
'plugin' => $this->map_plugin_to_options->get_plugin_name( $option->option_name ),
'value' => $option->option_value,
'value' => htmlentities( $option->option_value, ENT_QUOTES | ENT_SUBSTITUTE ),
'size' => number_format( strlen( $option->option_value ) / 1024, 2 ),
'autoload' => $option->autoload,
'row_id' => 'option_' . $option->option_name,
Expand Down

0 comments on commit 36f176c

Please sign in to comment.