3
3
* Plugin Name: HTML API Debugger
4
4
* Plugin URI: https://github.com/sirreal/html-api-debugger
5
5
* 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
9
9
* Author: Jon Surrell
10
10
* Author URI: https://profiles.wordpress.org/jonsurrell/
11
11
* License: GPLv2 or later
22
22
require_once __DIR__ . '/html-api-integration.php ' ;
23
23
24
24
const SLUG = 'html-api-debugger ' ;
25
- const VERSION = '2.1 ' ;
25
+ const VERSION = '2.2 ' ;
26
26
27
27
/** Set up the plugin. */
28
28
function init () {
@@ -44,8 +44,7 @@ function () {
44
44
// phpcs:ignore Universal.Operators.DisallowShortTernary.Found
45
45
$ html = $ request ->get_json_params ()['html ' ] ?: '' ;
46
46
$ 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 ,
49
48
);
50
49
return prepare_html_result_object ( $ html , $ options );
51
50
},
@@ -111,14 +110,19 @@ function () {
111
110
function () {
112
111
require_once __DIR__ . '/interactivity.php ' ;
113
112
113
+ $ options = array (
114
+ 'context_html ' => null ,
115
+ );
116
+
114
117
$ html = '' ;
115
118
// phpcs:disable WordPress.Security.NonceVerification.Recommended
116
119
if ( isset ( $ _GET ['html ' ] ) && is_string ( $ _GET ['html ' ] ) ) {
117
120
$ html = stripslashes ( $ _GET ['html ' ] );
118
121
}
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
122
126
123
127
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
124
128
echo namespace \Interactivity \generate_page ( $ html , $ options );
@@ -141,7 +145,7 @@ function prepare_html_result_object( string $html, array $options = null ): arra
141
145
'html ' => $ html ,
142
146
'error ' => null ,
143
147
'result ' => null ,
144
- 'normalizedHtml ' => HTML_API_Integration \get_normalized_html ( $ html ),
148
+ 'normalizedHtml ' => HTML_API_Integration \get_normalized_html ( $ html, $ options ),
145
149
);
146
150
147
151
try {
0 commit comments