PluginProbe
phpinfo() WP – Site Health, PHP Compatibility & Server Audit / 7.2.5
phpinfo() WP – Site Health, PHP Compatibility & Server Audit v7.2.5
7.2.7 7.2.6 7.2.5 7.2.4 7.2.3 7.2.0 7.2.1 7.2.2 7.1.0 7.0.3 7.0.4 7.0.5 trunk 6.0 7.0.0 7.0.1 7.0.2
phpinfo-wp / views / safemode.php

safemode.php in phpinfo() WP – Site Health, PHP Compatibility & Server Audit 7.2.5, at views/safemode.php

583 lines 29.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined('ABSPATH') or die('Unauthorized Access');
3
4 if (!current_user_can('manage_options')) wp_die('Insufficient permissions.');
5
6 $notice = '';
7 $action = '';
8
9 if ($_SERVER['REQUEST_METHOD'] === 'POST') {
10 if (isset($_POST['phpinfowp_safemode_start']) && check_admin_referer('phpinfowp_safemode_start_nonce')) {
11 $disabled = isset($_POST['disable']) && is_array($_POST['disable'])
12 ? array_map('sanitize_text_field', (array) $_POST['disable'])
13 : [];
14 $disable_theme = !empty($_POST['disable_theme']);
15 $duration = (int) ($_POST['duration'] ?? Phpinfo_WP_Safemode::DEFAULT_DURATION);
16 $result = Phpinfo_WP_Safemode::start($disabled, $disable_theme, $duration);
17 $action = 'started';
18 $start_result = $result;
19 // Redirect so the new cookie/transient applies on the next request
20 wp_safe_redirect(add_query_arg(['safemode' => 'started'], admin_url('admin.php?page=phpinfowp-safemode')));
21 exit;
22 }
23 if (isset($_POST['phpinfowp_safemode_stop']) && check_admin_referer('phpinfowp_safemode_stop_nonce')) {
24 Phpinfo_WP_Safemode::stop();
25 wp_safe_redirect(add_query_arg(['safemode' => 'stopped'], admin_url('admin.php?page=phpinfowp-safemode')));
26 exit;
27 }
28 if (isset($_POST['phpinfowp_safemode_remove_mu']) && check_admin_referer('phpinfowp_safemode_remove_mu_nonce')) {
29 $ok = Phpinfo_WP_Safemode::uninstall_mu_plugin();
30 $notice = $ok ? 'mu-plugin removed.' : 'Could not remove mu-plugin (check file permissions).';
31 }
32 }
33
34 if (isset($_GET['safemode']) && $_GET['safemode'] === 'started') $notice = 'Troubleshooting Mode engaged — only your admin session sees plugins disabled. The site is normal for other visitors.';
35 if (isset($_GET['safemode']) && $_GET['safemode'] === 'stopped') $notice = 'Troubleshooting Mode ended. All plugins restored.';
36
37 $is_pro = Phpinfo_WP_License::is_valid();
38 $show_success_modal = isset($_GET['safemode']) && $_GET['safemode'] === 'stopped' && !$is_pro;
39 if ($show_success_modal) {
40 $notice = '';
41 }
42
43 $session = Phpinfo_WP_Safemode::current_session();
44 $is_active = $session !== null;
45 $mu_present = Phpinfo_WP_Safemode::mu_plugin_installed();
46
47 if (!function_exists('get_plugins')) require_once ABSPATH . 'wp-admin/includes/plugin.php';
48 $all_plugins = get_plugins();
49 $active_plugins = (array) get_option('active_plugins', []);
50 ?>
51
52 <div class="phpinfowp-info-page phpinfowp-safemode">
53 <style>
54 /* Safe mode wrapper classes */
55 .phpinfowp-safemode {
56 max-width: 1000px;
57 padding-top: 20px;
58 }
59
60 /* Custom Table Styles */
61 .phpinfowp-table {
62 width: 100%;
63 border-collapse: collapse;
64 margin: 16px 0 24px;
65 background: #fff;
66 border: 1px solid #dcdcde;
67 border-radius: 6px;
68 overflow: hidden;
69 box-shadow: none;
70 }
71 .phpinfowp-table th {
72 background: #f8fafc;
73 color: #666;
74 font-weight: 700;
75 font-size: 11px;
76 text-transform: uppercase;
77 letter-spacing: 0.5px;
78 padding: 12px 14px;
79 text-align: left;
80 border-bottom: 1px solid #dcdcde;
81 }
82 .phpinfowp-table td {
83 padding: 12px 14px;
84 border-bottom: 1px solid #f0f0f1;
85 font-size: 13px;
86 color: #333;
87 vertical-align: middle;
88 }
89 .phpinfowp-table tr:last-child td {
90 border-bottom: none;
91 }
92 .phpinfowp-table tr:hover td {
93 background: #f8fafc;
94 }
95
96 /* Badge styles */
97 .phpinfowp-badge {
98 display: inline-flex;
99 align-items: center;
100 gap: 4px;
101 font-size: 10px;
102 font-weight: 700;
103 padding: 3px 8px;
104 border-radius: 20px;
105 text-transform: uppercase;
106 letter-spacing: 0.5px;
107 }
108 .phpinfowp-badge-success {
109 background: #d1fae5;
110 color: #065f46;
111 }
112 .phpinfowp-badge-neutral {
113 background: #f1f5f9;
114 color: #475569;
115 }
116
117 /* Custom alert banner style */
118 .phpinfowp-custom-alert {
119 margin-bottom: 20px;
120 padding: 12px 16px;
121 border-radius: 6px;
122 display: flex;
123 align-items: flex-start;
124 gap: 12px;
125 }
126
127
128
129 /* Styled buttons */
130 .phpinfowp-btn {
131 display: inline-flex;
132 align-items: center;
133 justify-content: center;
134 gap: 6px;
135 padding: 8px 16px;
136 border-radius: 6px;
137 font-size: 13px;
138 font-weight: 600;
139 cursor: pointer;
140 transition: all 0.15s ease;
141 border: 1px solid transparent;
142 text-decoration: none;
143 line-height: 1.4;
144 }
145 .phpinfowp-btn-primary {
146 background: #777BB3;
147 color: #fff;
148 border-color: #696da6;
149 }
150 .phpinfowp-btn-primary:hover {
151 background: #696da6;
152 color: #fff;
153 }
154 .phpinfowp-btn-primary:active {
155 background: #595d92;
156 }
157 .phpinfowp-btn-primary:disabled {
158 background: #cbd5e1;
159 border-color: #cbd5e1;
160 color: #94a3b8;
161 cursor: not-allowed;
162 }
163
164 .phpinfowp-btn-secondary {
165 background: #fff;
166 color: #334155;
167 border-color: #cbd5e1;
168 }
169 .phpinfowp-btn-secondary:hover {
170 background: #f8fafc;
171 border-color: #94a3b8;
172 color: #0f172a;
173 }
174
175 .phpinfowp-btn-danger {
176 background: #ef4444;
177 color: #fff;
178 border-color: #ef4444;
179 }
180 .phpinfowp-btn-danger:hover {
181 background: #dc2626;
182 border-color: #dc2626;
183 color: #fff;
184 }
185
186 /* Pulse Animation */
187 @keyframes phpinfowp-pulse {
188 0% { transform: scale(0.95); opacity: 0.5; }
189 50% { transform: scale(1.15); opacity: 1; }
190 100% { transform: scale(0.95); opacity: 0.5; }
191 }
192 .phpinfowp-pulse-dot {
193 width: 8px;
194 height: 8px;
195 border-radius: 50%;
196 background: #10b981;
197 display: inline-block;
198 animation: phpinfowp-pulse 2s infinite ease-in-out;
199 }
200 </style>
201
202 <div class="phpinfowp-page-header">
203 <div>
204 <h1><?php _e('Troubleshooting Mode', 'phpinfo-wp'); ?></h1>
205 <p class="phpinfowp-page-subtitle"><?php _e('Safely disable plugins or revert to a default theme <strong>just for your own admin session</strong> to debug
206 conflicts. Visitors see the site normally. Everything is reversible — no plugin is ever deactivated in the
207 database. Session expires automatically; you can also exit any time.', 'phpinfo-wp'); ?></p>
208 </div>
209 </div>
210
211 <!-- Notices bar -->
212 <?php if ($notice): ?>
213 <div class="phpinfowp-custom-alert" style="background:#f0fdf4; border:1px solid #bbf7d0; border-left:4px solid #22c55e;">
214 <span class="dashicons dashicons-yes" style="color: #22c55e; font-size: 20px; width: 20px; height: 20px; flex-shrink: 0;"></span>
215 <p style="color: #166534; font-weight: 500;"><?php echo esc_html($notice); ?></p>
216 </div>
217 <?php endif; ?>
218
219 <!-- Switch rendering based on active status -->
220 <?php if ($is_active): ?>
221 <?php
222 $remaining = max(0, $session['expires'] - time());
223 $mins = (int) floor($remaining / 60);
224 $secs = $remaining % 60;
225 $disabled = (array) ($session['disabled_plugins'] ?? []);
226 ?>
227
228 <!-- Active Troubleshooting Mode Panel -->
229 <div style="background: linear-gradient(135deg, #fef3c7, #fffbeb); border: 1px solid #fde047; border-left: 5px solid #eab308; border-radius: 10px; padding: 24px; margin-bottom: 28px; box-shadow: 0 4px 15px rgba(234, 179, 8, 0.08);">
230 <div style="display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px;">
231 <div>
232 <div style="display: flex; align-items: center; gap: 8px; color: #854d0e; font-size: 16px; font-weight: 800;">
233 <span class="phpinfowp-pulse-dot" style="background: #eab308; width: 8px; height: 8px;"></span>
234 Troubleshooting Mode is Active
235 </div>
236 <p style="margin: 8px 0 0; color: #713f12; font-size: 13.5px; line-height: 1.5;">
237 We've disabled <strong><?php echo count($disabled); ?> plugin<?php echo count($disabled) === 1 ? '' : 's'; ?></strong> just for your current administrator session.
238 <?php if (!empty($session['disable_theme'])): ?>Additionally, the default theme is temporarily active.<?php endif; ?>
239 All other website visitors will see your site active and normal with no plugins disabled.
240 </p>
241 </div>
242 <div style="text-align: right; background: #fff; padding: 12px 20px; border-radius: 8px; border: 1px solid #fef08a; box-shadow: 0 2px 6px rgba(0,0,0,0.02); min-width: 120px;">
243 <div id="phpinfowp-safemode-countdown"
244 data-expires="<?php echo esc_attr($session['expires']); ?>"
245 style="font-size: 26px; font-weight: 800; color: #854d0e; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; letter-spacing: -0.5px;">
246 <?php printf('%d:%02d', $mins, $secs); ?>
247 </div>
248 <div style="font-size: 10px; color: #a16207; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px;"><?php _e('remaining', 'phpinfo-wp'); ?></div>
249 </div>
250 </div>
251
252 <form method="post" style="margin-top: 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;">
253 <?php wp_nonce_field('phpinfowp_safemode_stop_nonce'); ?>
254 <input type="hidden" name="phpinfowp_safemode_stop" value="1">
255 <button type="submit" class="phpinfowp-btn phpinfowp-btn-danger" style="padding: 10px 20px;">
256 <span class="dashicons dashicons-dismiss" style="font-size:16px; width:16px; height:16px; margin-top:1px;"></span>
257 End Troubleshooting Session
258 </button>
259 <a href="<?php echo esc_url(admin_url()); ?>" class="phpinfowp-btn phpinfowp-btn-secondary" style="padding: 10px 18px;">
260 Browse Site Admin →
261 </a>
262 </form>
263 </div>
264
265 <h2 class="phpinfowp-section-heading"><?php _e('Plugins disabled in this session', 'phpinfo-wp'); ?></h2>
266
267 <table class="phpinfowp-table" style="max-width:780px">
268 <thead>
269 <tr>
270 <th><?php _e('Plugin', 'phpinfo-wp'); ?></th>
271 <th style="width:200px"><?php _e('Status in DB', 'phpinfo-wp'); ?></th>
272 </tr>
273 </thead>
274 <tbody>
275 <?php foreach ($disabled as $slug): $info = $all_plugins[$slug] ?? null; ?>
276 <tr>
277 <td>
278 <strong style="color: #0f172a; font-size: 13.5px;"><?php echo esc_html($info['Name'] ?? $slug); ?></strong>
279 <div style="font-size:11px; color:#64748b; font-family:monospace; margin-top:2px;"><?php echo esc_html($slug); ?></div>
280 </td>
281 <td>
282 <span style="color:#0f9d58; font-weight:700; display:flex; align-items:center; gap:4px;">
283 <span class="phpinfowp-pulse-dot" style="background:#0f9d58;"></span>
284 Active in database
285 </span>
286 <span style="color:#64748b; font-size:11px; display:block; margin-top:2px;">(hidden from your session view only)</span>
287 </td>
288 </tr>
289 <?php endforeach; ?>
290 </tbody>
291 </table>
292
293 <script>
294 (function() {
295 var el = document.getElementById('phpinfowp-safemode-countdown');
296 if (!el) return;
297 var expires = parseInt(el.dataset.expires, 10);
298 function tick() {
299 var remaining = Math.max(0, expires - Math.floor(Date.now() / 1000));
300 var m = Math.floor(remaining / 60);
301 var s = remaining % 60;
302 el.textContent = m + ':' + (s < 10 ? '0' : '') + s;
303 if (remaining <= 0) {
304 el.textContent = 'expired';
305 setTimeout(function() { window.location.reload(); }, 1500);
306 return;
307 }
308 setTimeout(tick, 1000);
309 }
310 tick();
311 })();
312 </script>
313
314 <?php else: ?>
315
316 <!-- Difference Feature Grid -->
317 <div class="phpinfowp-diff-box" style="background:#fff; border:1px solid #e2e8f0; border-radius:12px; padding:24px; margin-bottom:28px; box-shadow:0 1px 3px rgba(0,0,0,0.02);">
318 <div style="font-size:16px; font-weight:700; color:#0f172a; margin-bottom:18px; display:flex; align-items:center; gap:8px;">
319 <span class="dashicons dashicons-info" style="color:#777BB3; font-size:20px; width:20px; height:20px;"></span>
320 How this differs from the official Health Check plugin
321 </div>
322 <div class="phpinfowp-diff-grid" style="display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:18px;">
323 <!-- Item 1 -->
324 <div class="phpinfowp-diff-item" style="border:1px solid #f1f5f9; background:#f8fafc; border-radius:8px; padding:16px; transition: all 0.2s ease;">
325 <div style="display:flex; align-items:center; gap:8px; font-weight:700; color:#1e293b; font-size:13px; margin-bottom:6px;">
326 <span class="dashicons dashicons-shield-alt" style="color:#10b981; font-size:16px; width:16px; height:16px;"></span>
327 Safe DB Sandbox
328 </div>
329 <div style="font-size:12.5px; color:#64748b; line-height:1.5;">
330 The actual <code>active_plugins</code> option is never modified — your site cannot be left broken.
331 </div>
332 </div>
333 <!-- Item 2 -->
334 <div class="phpinfowp-diff-item" style="border:1px solid #f1f5f9; background:#f8fafc; border-radius:8px; padding:16px; transition: all 0.2s ease;">
335 <div style="display:flex; align-items:center; gap:8px; font-weight:700; color:#1e293b; font-size:13px; margin-bottom:6px;">
336 <span class="dashicons dashicons-lock" style="color:#3b82f6; font-size:16px; width:16px; height:16px;"></span>
337 Session Bound
338 </div>
339 <div style="font-size:12.5px; color:#64748b; line-height:1.5;"><?php _e('Cookie is bound to your user account, time-limited, and expires automatically.', 'phpinfo-wp'); ?></div>
340 </div>
341 <!-- Item 3 -->
342 <div class="phpinfowp-diff-item" style="border:1px solid #f1f5f9; background:#f8fafc; border-radius:8px; padding:16px; transition: all 0.2s ease;">
343 <div style="display:flex; align-items:center; gap:8px; font-weight:700; color:#1e293b; font-size:13px; margin-bottom:6px;">
344 <span class="dashicons dashicons-dismiss" style="color:#ef4444; font-size:16px; width:16px; height:16px;"></span>
345 No Lockouts
346 </div>
347 <div style="font-size:12.5px; color:#64748b; line-height:1.5;"><?php _e('Every page has an explicit <em>End</em> button. You cannot lock yourself out.', 'phpinfo-wp'); ?></div>
348 </div>
349 <!-- Item 4 -->
350 <div class="phpinfowp-diff-item" style="border:1px solid #f1f5f9; background:#f8fafc; border-radius:8px; padding:16px; transition: all 0.2s ease;">
351 <div style="display:flex; align-items:center; gap:8px; font-weight:700; color:#1e293b; font-size:13px; margin-bottom:6px;">
352 <span class="dashicons dashicons-groups" style="color:#8b5cf6; font-size:16px; width:16px; height:16px;"></span>
353 Zero Visitor Impact
354 </div>
355 <div style="font-size:12.5px; color:#64748b; line-height:1.5;"><?php _e('Other visitors are unaffected they see the live site with all plugins active.', 'phpinfo-wp'); ?></div>
356 </div>
357 </div>
358 </div>
359
360 <!-- Installation Status warning helper -->
361 <?php if (!$mu_present): ?>
362 <div class="phpinfowp-custom-alert" style="background:#eff6ff; border:1px solid #bfdbfe; border-left:4px solid #3b82f6; border-radius:8px; padding:16px 20px; margin-bottom:24px; display:flex; gap:12px; align-items:flex-start;">
363 <span class="dashicons dashicons-info-outline" style="color:#3b82f6; font-size:20px; width:20px; height:20px; flex-shrink:0; margin-top:2px;"></span>
364 <div>
365 <strong style="color:#1e3a8a; font-size:13.5px; display:block; margin-bottom:4px;"><?php _e('Request-Level Isolation Recommended', 'phpinfo-wp'); ?></strong>
366 <p style="margin:0; font-size:13px; color:#1e40af; line-height:1.5;">
367 The optional <code>mu-plugin</code> helper isn't installed yet. Without it, disabled plugins are only hidden in the <em>admin panel and AJAX requests</em>, but will run normally on frontend pages.
368 Engaging Troubleshooting Mode will attempt to install it automatically; if your directory is write-protected, it will fallback to admin-only isolation.
369 </p>
370 </div>
371 </div>
372 <?php else: ?>
373 <div class="phpinfowp-custom-alert" style="background:#f0fdf4; border:1px solid #bbf7d0; border-radius:8px; padding:14px 18px; margin-bottom:24px; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px;">
374 <div style="display:flex; align-items:center; gap:8px;">
375 <span class="dashicons dashicons-yes-alt" style="color:#10b981; font-size:18px; width:18px; height:18px;"></span>
376 <span style="font-size:13px; color:#166534; font-weight:600;">
377 Full Request-Level Isolation Available
378 </span>
379 <span style="font-size:12px; color:#4b5563; font-family:monospace; background:#f3f4f6; padding:2px 6px; border-radius:4px; border:1px solid #e5e7eb; margin-left:4px;">
380 mu-plugins/<?php echo esc_html(Phpinfo_WP_Safemode::MU_FILE); ?>
381 </span>
382 </div>
383 <form method="post" style="display:inline; margin:0;">
384 <?php wp_nonce_field('phpinfowp_safemode_remove_mu_nonce'); ?>
385 <input type="hidden" name="phpinfowp_safemode_remove_mu" value="1">
386 <button type="submit" class="phpinfowp-btn phpinfowp-btn-danger" style="padding:4px 10px; font-size:11.5px; border-radius:4px;"
387 onclick="return confirm('Remove the helper mu-plugin? Troubleshooting Mode will fallback to admin-only isolation.')"><?php _e('Uninstall Helper', 'phpinfo-wp'); ?></button>
388 </form>
389 </div>
390 <?php endif; ?>
391
392 <!-- Form Setup -->
393 <form method="post">
394 <?php wp_nonce_field('phpinfowp_safemode_start_nonce'); ?>
395 <input type="hidden" name="phpinfowp_safemode_start" value="1">
396
397 <h2 class="phpinfowp-section-heading"><?php _e('Pick what to disable', 'phpinfo-wp'); ?></h2>
398
399 <div style="margin:8px 0 16px">
400 <label style="display:flex;align-items:center;gap:8px;font-weight:600; font-size:13px; color:#1e293b; cursor:pointer;">
401 <input type="checkbox" id="phpinfowp-toggle-all" onchange="phpinfowpToggleAll(this.checked)">
402 Select all active plugins
403 </label>
404 </div>
405
406 <!-- Sleek Table list of plugins -->
407 <table class="phpinfowp-table" style="max-width:780px">
408 <thead>
409 <tr>
410 <th style="width:40px"></th>
411 <th><?php _e('Plugin', 'phpinfo-wp'); ?></th>
412 <th style="width:140px"><?php _e('Version', 'phpinfo-wp'); ?></th>
413 <th style="width:120px"><?php _e('Status', 'phpinfo-wp'); ?></th>
414 </tr>
415 </thead>
416 <tbody>
417 <?php foreach ($all_plugins as $slug => $info):
418 $is_active = in_array($slug, $active_plugins, true);
419 ?>
420 <tr class="<?php echo $is_active ? 'active-row' : 'inactive-row'; ?>" style="<?php echo $is_active ? '' : 'opacity:.55'; ?>">
421 <td>
422 <input type="checkbox" name="disable[]" value="<?php echo esc_attr($slug); ?>"
423 class="phpinfowp-disable-checkbox"
424 <?php disabled(!$is_active); ?>>
425 </td>
426 <td>
427 <strong style="color: #0f172a; font-size: 13.5px;"><?php echo esc_html($info['Name']); ?></strong>
428 <div style="font-size:11px; color:#64748b; font-family:monospace; margin-top:2px;"><?php echo esc_html($slug); ?></div>
429 </td>
430 <td style="font-family:monospace; font-size:12px; color:#475569;"><?php echo esc_html($info['Version']); ?></td>
431 <td>
432 <?php if ($is_active): ?>
433 <span class="phpinfowp-badge phpinfowp-badge-success" style="padding: 2px 6px;"><?php _e('Active', 'phpinfo-wp'); ?></span>
434 <?php else: ?>
435 <span class="phpinfowp-badge phpinfowp-badge-neutral" style="padding: 2px 6px;"><?php _e('Inactive', 'phpinfo-wp'); ?></span>
436 <?php endif; ?>
437 </td>
438 </tr>
439 <?php endforeach; ?>
440 </tbody>
441 </table>
442
443 <!-- Theme Card -->
444 <div style="background:#fff; border:1px solid #e2e8f0; border-radius:8px; padding:20px; margin-bottom:20px; box-shadow:0 1px 2px rgba(0,0,0,0.01); max-width:780px;">
445 <h2 style="margin:0 0 10px; font-size:15px; font-weight:700; color:#0f172a; display:flex; align-items:center; gap:6px;">
446 <span class="dashicons dashicons-admin-appearance" style="color:#777BB3; font-size:18px; width:18px; height:18px;"></span>
447 Theme Isolation
448 </h2>
449 <p style="margin:0 0 12px; font-size:12.5px; color:#64748b; line-height:1.4;"><?php _e('Revert your session to a default theme to verify if a layout conflict is originating from your current theme.', 'phpinfo-wp'); ?></p>
450 <label style="display:flex; align-items:center; gap:8px; font-weight:600; font-size:13px; color:#1e293b; cursor:pointer;">
451 <input type="checkbox" name="disable_theme" value="1">
452 Also revert to default WordPress theme (<?php echo esc_html(defined('WP_DEFAULT_THEME') && WP_DEFAULT_THEME ? WP_DEFAULT_THEME : 'twentytwentyfour'); ?>)
453 </label>
454 </div>
455
456 <!-- Duration Select -->
457 <div style="background:#fff; border:1px solid #e2e8f0; border-radius:8px; padding:20px; margin-bottom:24px; box-shadow:0 1px 2px rgba(0,0,0,0.01); max-width:780px;">
458 <h2 style="margin:0 0 10px; font-size:15px; font-weight:700; color:#0f172a; display:flex; align-items:center; gap:6px;">
459 <span class="dashicons dashicons-clock" style="color:#777BB3; font-size:18px; width:18px; height:18px;"></span>
460 Session Duration
461 </h2>
462 <p style="margin:0 0 12px; font-size:12.5px; color:#64748b; line-height:1.4;"><?php _e('Select how long you want Troubleshooting Mode to remain active before automatically expiring.', 'phpinfo-wp'); ?></p>
463 <select name="duration" style="min-width:240px; padding:8px 12px; border-radius:6px; border:1px solid #cbd5e1; font-size:13px; background:#fff; color:#334155; outline:none;">
464 <option value="900"><?php _e('15 minutes', 'phpinfo-wp'); ?></option>
465 <option value="1800"><?php _e('30 minutes', 'phpinfo-wp'); ?></option>
466 <option value="3600" selected><?php _e('1 hour (recommended)', 'phpinfo-wp'); ?></option>
467 <option value="7200"><?php _e('2 hours', 'phpinfo-wp'); ?></option>
468 <option value="14400"><?php _e('4 hours (max)', 'phpinfo-wp'); ?></option>
469 </select>
470 </div>
471
472 <!-- Start Trigger action -->
473 <div style="display:flex; align-items:center; gap:16px; margin-top:24px;">
474 <button type="submit" class="phpinfowp-btn phpinfowp-btn-primary" style="padding:12px 24px; font-size:14px; border-radius:6px; height:auto;" id="phpinfowp-start-btn" disabled>
475 <span class="dashicons dashicons-shield-alt" style="font-size:16px; width:16px; height:16px; margin-top:2px;"></span>
476 Engage Troubleshooting Mode
477 </button>
478 <span id="phpinfowp-btn-helper" style="color:#94a3b8; font-size:12.5px;"><?php _e('Select at least one plugin to enable the button', 'phpinfo-wp'); ?></span>
479 </div>
480 </form>
481
482 <script>
483 function phpinfowpToggleAll(checked) {
484 document.querySelectorAll('.phpinfowp-disable-checkbox:not(:disabled)').forEach(function(cb) {
485 cb.checked = checked;
486 });
487 phpinfowpUpdateStartBtn();
488 }
489 function phpinfowpUpdateStartBtn() {
490 var checked = document.querySelectorAll('.phpinfowp-disable-checkbox:checked').length > 0;
491 var btn = document.getElementById('phpinfowp-start-btn');
492 var helper = document.getElementById('phpinfowp-btn-helper');
493 btn.disabled = !checked;
494 if (checked) {
495 helper.textContent = "Ready to engage.";
496 helper.style.color = "#10b981";
497 } else {
498 helper.textContent = "Select at least one plugin to enable the button";
499 helper.style.color = "#94a3b8";
500 }
501 }
502 document.querySelectorAll('.phpinfowp-disable-checkbox').forEach(function(cb) {
503 cb.addEventListener('change', phpinfowpUpdateStartBtn);
504 });
505 </script>
506
507 <?php endif; ?>
508 </div>
509
510 <?php if ($show_success_modal): ?>
511 <!-- Troubleshooting Mode Success Modal -->
512 <div id="phpinfowp-success-modal" class="phpinfowp-success-modal" role="dialog" aria-modal="true" aria-labelledby="phpinfowp-success-modal-title">
513 <div class="phpinfowp-success-modal-content">
514 <div style="width:54px; height:54px; border-radius:50%; background:rgba(34, 197, 94, 0.12); display:flex; align-items:center; justify-content:center; margin:0 auto 18px;">
515 <span class="dashicons dashicons-yes" style="font-size:32px; width:32px; height:32px; color:#22c55e;"></span>
516 </div>
517 <h2 id="phpinfowp-success-modal-title" style="margin: 0 0 10px; font-size: 20px; font-weight: 600; color: #1d2327;"><?php _e('Conflict resolved!', 'phpinfo-wp'); ?></h2>
518 <p style="margin: 0 0 24px; font-size: 13.5px; color: #475569; line-height: 1.5; text-align: center;">
519 <?php _e('Pro\'s Update Guard automatically intercepts updates and warns you about version incompatibilities before you activate them. Never experience another broken dashboard.', 'phpinfo-wp'); ?>
520 </p>
521 <div style="display:flex; justify-content:center; gap:12px;">
522 <button type="button" class="button phpinfowp-success-modal-close" style="height:40px; line-height:38px; font-size:13.5px; font-weight:600; padding:0 20px; border-radius:6px;"><?php _e('Dismiss', 'phpinfo-wp'); ?></button>
523 <a href="https://exeebit.com/phpinfo-wp#pricing" target="_blank" rel="noopener" class="button button-primary" style="background:#777BB3; border-color:#777BB3; height:40px; line-height:38px; font-size:13.5px; font-weight:600; padding:0 20px; border-radius:6px; text-decoration:none; display:inline-block;"><?php _e('Explore Pro Security', 'phpinfo-wp'); ?></a>
524 </div>
525 </div>
526 </div>
527
528 <style>
529 .phpinfowp-success-modal {
530 display: none;
531 position: fixed;
532 z-index: 999999;
533 left: 0;
534 top: 0;
535 width: 100%;
536 height: 100%;
537 background-color: rgba(15, 23, 42, 0.45);
538 backdrop-filter: blur(4px);
539 align-items: center;
540 justify-content: center;
541 opacity: 0;
542 transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
543 }
544 .phpinfowp-success-modal.is-open {
545 display: flex;
546 opacity: 1;
547 }
548 .phpinfowp-success-modal-content {
549 background-color: #fff;
550 padding: 36px 30px;
551 border: 1px solid #e2e8f0;
552 width: 90%;
553 max-width: 500px;
554 border-radius: 10px;
555 box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
556 transform: scale(0.95);
557 transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
558 }
559 .phpinfowp-success-modal.is-open .phpinfowp-success-modal-content {
560 transform: scale(1);
561 }
562 </style>
563
564 <script>
565 jQuery(document).ready(function($) {
566 var $modal = $('#phpinfowp-success-modal');
567 setTimeout(function() {
568 $modal.addClass('is-open');
569 }, 150);
570
571 $(document).on('click', '.phpinfowp-success-modal-close, .phpinfowp-success-modal', function(e) {
572 if ($(e.target).hasClass('phpinfowp-success-modal') || $(e.target).hasClass('phpinfowp-success-modal-close')) {
573 $modal.removeClass('is-open');
574 if (window.history && window.history.replaceState) {
575 var url = window.location.href.split('?')[0] + '?page=phpinfowp-safemode';
576 window.history.replaceState({}, document.title, url);
577 }
578 }
579 });
580 });
581 </script>
582 <?php endif; ?>
583