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 / pro / ssl.php

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

140 lines 7.1 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 (!Phpinfo_WP_License::is_valid()) {
5 phpinfowp_render_feature_lock([
6 'feature' => 'SSL Certificate Monitor',
7 'icon' => 'dashicons-lock',
8 'tagline' => 'Track certificate expiry for your domain and any additional domains — get alerted before they lapse.',
9 'previews' => [
10 'Issuer: <strong>—</strong>',
11 'Expires: <strong>— days remaining</strong>',
12 'Status: <strong>—</strong>',
13 'Covers: <strong>— domain(s)</strong>',
14 ],
15 ]);
16 return;
17 }
18
19 $message = '';
20 $msg_type = 'success';
21
22 if (isset($_POST['phpinfowp_ssl_action']) && check_admin_referer('phpinfowp_ssl_nonce')) {
23 $action = sanitize_text_field($_POST['phpinfowp_ssl_action']);
24 if ($action === 'recheck') {
25 Phpinfo_WP_SSL::bust_cache();
26 $message = 'Cache cleared — re-checking all certificates.';
27 } elseif ($action === 'save_domains') {
28 Phpinfo_WP_SSL::save_extra_domains($_POST['ssl_domains'] ?? '');
29 $message = 'Domain list saved.';
30 }
31 }
32
33 $results = Phpinfo_WP_SSL::check_all();
34 $any_cached = array_filter($results, function ($r) {
35 return !empty($r['cached']);
36 });
37 ?>
38
39 <div class="phpinfowp-pro-page">
40 <div class="phpinfowp-page-header">
41 <div>
42 <h1>SSL Certificate Monitor <span class="phpinfowp-pro-badge"><?php _e('PRO', 'phpinfo-wp'); ?></span></h1>
43 <p class="phpinfowp-page-subtitle"><?php _e('Monitor SSL validity, expiration dates, and domain name mismatches.', 'phpinfo-wp'); ?></p>
44 </div>
45 </div>
46
47 <?php if ($message): ?>
48 <div class="notice notice-<?php echo $msg_type; ?> inline is-dismissible">
49 <p><?php echo esc_html($message); ?></p>
50 </div>
51 <?php endif; ?>
52
53 <!-- Certificate cards -->
54 <div class="phpinfowp-ssl-grid">
55 <?php foreach ($results as $cert): ?>
56 <?php if (!empty($cert['error'])): ?>
57 <div class="phpinfowp-ssl-card phpinfowp-ssl-error">
58 <div class="phpinfowp-ssl-card-host"><?php echo esc_html($cert['host'] ?? ''); ?></div>
59 <div class="phpinfowp-ssl-card-status" style="color:#d63638"><?php _e('ERROR', 'phpinfo-wp'); ?></div>
60 <div class="phpinfowp-ssl-card-days" style="font-size:13px;color:#d63638">
61 <?php echo esc_html($cert['error']); ?>
62 </div>
63 </div>
64 <?php else:
65 $color = Phpinfo_WP_SSL::status_color($cert['status']);
66 $label = Phpinfo_WP_SSL::status_label($cert['status']);
67 ?>
68 <div class="phpinfowp-ssl-card" style="border-top-color:<?php echo $color; ?>">
69 <div class="phpinfowp-ssl-card-host">
70 <?php echo esc_html($cert['host']); ?>
71 <?php if (!empty($cert['cached'])): ?>
72 <span style="font-size:10px;color:#999;font-weight:400"> (cached)</span>
73 <?php endif; ?>
74 </div>
75 <div class="phpinfowp-ssl-card-days" style="color:<?php echo $color; ?>">
76 <?php if ($cert['days'] < 0): ?>
77 Expired <?php echo esc_html(abs($cert['days'])); ?> days ago
78 <?php else: ?>
79 <?php echo esc_html($cert['days']); ?> <span style="font-size:14px;font-weight:400"><?php _e('days left', 'phpinfo-wp'); ?></span>
80 <?php endif; ?>
81 </div>
82 <div class="phpinfowp-ssl-card-status">
83 <span class="eol-badge eol-badge-<?php echo $cert['status'] === 'ok' ? 'ok' : ($cert['status'] === 'warning' ? 'warning' : 'eol'); ?>">
84 <?php echo $label; ?>
85 </span>
86 </div>
87 <table class="phpinfowp-ssl-card-meta">
88 <tr><td><?php _e('Expires', 'phpinfo-wp'); ?></td><td><?php echo esc_html($cert['expiry']); ?></td></tr>
89 <tr><td><?php _e('Issued', 'phpinfo-wp'); ?></td><td><?php echo esc_html($cert['issued']); ?></td></tr>
90 <tr><td><?php _e('Issuer', 'phpinfo-wp'); ?></td><td><?php echo esc_html($cert['issuer']); ?></td></tr>
91 <?php if (!empty($cert['cn']) && $cert['cn'] !== $cert['host']): ?>
92 <tr><td><?php _e('CN', 'phpinfo-wp'); ?></td><td><?php echo esc_html($cert['cn']); ?></td></tr>
93 <?php endif; ?>
94 <?php if (!empty($cert['sans'])): ?>
95 <tr>
96 <td><?php _e('SANs', 'phpinfo-wp'); ?></td>
97 <td style="font-size:11px;color:#666">
98 <?php echo esc_html(implode(', ', array_slice($cert['sans'], 0, 6))); ?>
99 <?php if (count($cert['sans']) > 6): ?>
100 <em>+<?php echo count($cert['sans']) - 6; ?> more</em>
101 <?php endif; ?>
102 </td>
103 </tr>
104 <?php endif; ?>
105 </table>
106 </div>
107 <?php endif; ?>
108 <?php endforeach; ?>
109 </div>
110
111 <div style="display:flex;gap:10px;margin-top:16px;align-items:center;flex-wrap:wrap">
112 <form method="post">
113 <?php wp_nonce_field('phpinfowp_ssl_nonce'); ?>
114 <input type="hidden" name="phpinfowp_ssl_action" value="recheck">
115 <button type="submit" class="button button-secondary"><?php _e('Re-check all certificates', 'phpinfo-wp'); ?></button>
116 </form>
117 <?php if ($any_cached): ?>
118 <span style="font-size:12px;color:#666"><?php _e('Results cached for 6 hours.', 'phpinfo-wp'); ?></span>
119 <?php endif; ?>
120 </div>
121
122 <!-- Extra domains -->
123 <div style="margin-top:32px;max-width:520px">
124 <h2 style="margin-bottom:8px"><?php _e('Monitor Additional Domains', 'phpinfo-wp'); ?></h2>
125 <p style="font-size:13px;color:#555;margin-bottom:12px">
126 Add hostnames you want to monitor (one per line). Useful for agencies managing client sites.<br>
127 Enter the domain only no <code>https://</code> or path. Example: <code>client.com</code>
128 </p>
129 <form method="post">
130 <?php wp_nonce_field('phpinfowp_ssl_nonce'); ?>
131 <input type="hidden" name="phpinfowp_ssl_action" value="save_domains">
132 <textarea name="ssl_domains" rows="5" class="large-text" style="font-family:monospace;font-size:13px"
133 placeholder="<?php echo esc_attr__('client-a.com&#10;client-b.com&#10;staging.mysite.com', 'phpinfo-wp'); ?>"><?php
134 echo esc_textarea(implode("\n", Phpinfo_WP_SSL::get_extra_domains()));
135 ?></textarea>
136 <p class="submit"><input type="submit" class="button button-primary" value="<?php echo esc_attr__('Save Domains', 'phpinfo-wp'); ?>"></p>
137 </form>
138 </div>
139 </div>
140