From a7a8272c8a2dd2974104e016b4831c8c46ad640e Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Thu, 16 May 2024 13:25:07 +0200 Subject: [PATCH 1/3] Run htmlentities over source to make it more easily copy pastable --- src/class-admin-page.php | 2 +- src/class-rest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/class-admin-page.php b/src/class-admin-page.php index 775821f..7a14734 100644 --- a/src/class-admin-page.php +++ b/src/class-admin-page.php @@ -435,7 +435,7 @@ private function get_value_button( string $name, $value ): string { ' . // translators: %s is the name of the option. '

' . sprintf( esc_html__( 'Value of %s', 'aaa-option-optimizer' ), '' . esc_html( $name ) . '' ) . '

-
' . esc_html( $string ) . '
+
' . htmlentities( $string ) . '
'; } diff --git a/src/class-rest.php b/src/class-rest.php index fdccab5..a428f32 100644 --- a/src/class-rest.php +++ b/src/class-rest.php @@ -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 ), 'size' => number_format( strlen( $option->option_value ) / 1024, 2 ), 'autoload' => $option->autoload, 'row_id' => 'option_' . $option->option_name, From 0e723ecea988586a356fdbb2bc3a6103b7cd8f86 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Thu, 16 May 2024 13:39:02 +0200 Subject: [PATCH 2/3] Fix CS --- src/class-admin-page.php | 2 +- src/class-rest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/class-admin-page.php b/src/class-admin-page.php index 7a14734..9689286 100644 --- a/src/class-admin-page.php +++ b/src/class-admin-page.php @@ -435,7 +435,7 @@ private function get_value_button( string $name, $value ): string { ' . // translators: %s is the name of the option. '

' . sprintf( esc_html__( 'Value of %s', 'aaa-option-optimizer' ), '' . esc_html( $name ) . '' ) . '

-
' . htmlentities( $string ) . '
+
' . htmlentities( $string, ENT_QUOTES | ENT_SUBSTITUTE ) . '
'; } diff --git a/src/class-rest.php b/src/class-rest.php index a428f32..8bde134 100644 --- a/src/class-rest.php +++ b/src/class-rest.php @@ -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' => htmlentities( $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, From 3720a6117aee0fd82bf1bcf27234c11d12415628 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Thu, 16 May 2024 13:40:54 +0200 Subject: [PATCH 3/3] Left align label --- css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/style.css b/css/style.css index 7973105..afbb992 100644 --- a/css/style.css +++ b/css/style.css @@ -49,6 +49,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; @@ -58,7 +59,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; }