-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_js_error.php
More file actions
21 lines (16 loc) · 870 Bytes
/
test_js_error.php
File metadata and controls
21 lines (16 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
define('WP_USE_THEMES', false);
require_once('../../../wp-load.php');
require_once('../../../wp-admin/includes/admin.php');
$admins = get_users(['role' => 'administrator']);
wp_set_current_user($admins[0]->ID);
ob_start();
// Output an error catcher script first
echo "<script>window.onerror = function(msg, url, lineNo, columnNo, error) { document.body.innerHTML += '<div style=\"color:red;font-size:20px;z-index:999999;position:fixed;top:0;left:0;background:white;padding:20px\">ERROR: ' + msg + ' at ' + lineNo + ':' + columnNo + '</div>'; };</script>";
do_action('admin_enqueue_scripts', 'tools_page_qa-assistant');
wp_print_scripts();
$menu = new \QaAssistant\Admin\Menu();
$menu->settings_page();
$html = ob_get_clean();
file_put_contents('test_settings_page.html', $html);
echo "HTML saved to test_settings_page.html. Length: " . strlen($html) . "\n";