33 * Plugin Name: HTML API Debugger
44 * Plugin URI: https://github.com/sirreal/html-api-debugger
55 * Description: Add a page to wp-admin for debugging the HTML API.
6- * Version: 2.1
7- * Requires at least: 6.6
8- * Tested up to: 6.7
6+ * Version: 2.2
7+ * Requires at least: 6.7
8+ * Tested up to: 6.8
99 * Author: Jon Surrell
1010 * Author URI: https://profiles.wordpress.org/jonsurrell/
1111 * License: GPLv2 or later
2222require_once __DIR__ . '/html-api-integration.php ' ;
2323
2424const SLUG = 'html-api-debugger ' ;
25- const VERSION = '2.1 ' ;
25+ const VERSION = '2.2 ' ;
2626
2727/** Set up the plugin. */
2828function init () {
@@ -44,8 +44,7 @@ function () {
4444 // phpcs:ignore Universal.Operators.DisallowShortTernary.Found
4545 $ html = $ request ->get_json_params ()['html ' ] ?: '' ;
4646 $ options = array (
47- 'quirks_mode ' => $ request ->get_json_params ()['quirksMode ' ] ?? false ,
48- 'full_parser ' => $ request ->get_json_params ()['fullParser ' ] ?? false ,
47+ 'context_html ' => $ request ->get_json_params ()['contextHTML ' ] ?: null ,
4948 );
5049 return prepare_html_result_object ( $ html , $ options );
5150 },
@@ -111,14 +110,19 @@ function () {
111110 function () {
112111 require_once __DIR__ . '/interactivity.php ' ;
113112
113+ $ options = array (
114+ 'context_html ' => null ,
115+ );
116+
114117 $ html = '' ;
115118 // phpcs:disable WordPress.Security.NonceVerification.Recommended
116119 if ( isset ( $ _GET ['html ' ] ) && is_string ( $ _GET ['html ' ] ) ) {
117120 $ html = stripslashes ( $ _GET ['html ' ] );
118121 }
119-
120- $ options = array ();
121- // @todo Add query args for other options
122+ if ( isset ( $ _GET ['contextHTML ' ] ) && is_string ( $ _GET ['contextHTML ' ] ) ) {
123+ $ options ['context_html ' ] = stripslashes ( $ _GET ['contextHTML ' ] );
124+ }
125+ // phpcs:enable WordPress.Security.NonceVerification.Recommended
122126
123127 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
124128 echo namespace \Interactivity \generate_page ( $ html , $ options );
@@ -141,7 +145,7 @@ function prepare_html_result_object( string $html, array $options = null ): arra
141145 'html ' => $ html ,
142146 'error ' => null ,
143147 'result ' => null ,
144- 'normalizedHtml ' => HTML_API_Integration \get_normalized_html ( $ html ),
148+ 'normalizedHtml ' => HTML_API_Integration \get_normalized_html ( $ html, $ options ),
145149 );
146150
147151 try {
0 commit comments