| 1 |
<?php |
| 2 |
defined('ABSPATH') or die('Unauthorized Access'); |
| 3 |
|
| 4 |
/** |
| 5 |
* Inline feature-lock teaser. |
| 6 |
* |
| 7 |
* Usage — replace the hard redirect at the top of any Pro view with: |
| 8 |
* |
| 9 |
* if (!Phpinfo_WP_License::is_valid()) { |
| 10 |
* phpinfowp_render_feature_lock([ |
| 11 |
* 'feature' => 'OPcache Dashboard', |
| 12 |
* 'icon' => 'dashicons-performance', |
| 13 |
* 'tagline' => 'Hit rate, memory usage, cached scripts, one-click clear.', |
| 14 |
* 'previews' => [ |
| 15 |
* 'Hit rate: <strong>—</strong>', |
| 16 |
* 'Memory used: <strong>—</strong>', |
| 17 |
* 'Cached scripts: <strong>—</strong>', |
| 18 |
* ], |
| 19 |
* ]); |
| 20 |
* return; |
| 21 |
* } |
| 22 |
* |
| 23 |
* The function is defined once and guarded so it can be required from |
| 24 |
* multiple views without a fatal redeclaration error. |
| 25 |
*/ |
| 26 |
|
| 27 |
if (!function_exists('phpinfowp_render_feature_lock')): |
| 28 |
|
| 29 |
function phpinfowp_render_feature_lock(array $args = []): void { |
| 30 |
$feature = $args['feature'] ?? 'This feature'; |
| 31 |
$icon = $args['icon'] ?? 'dashicons-lock'; |
| 32 |
$tagline = $args['tagline'] ?? 'Available in phpinfo() WP Pro.'; |
| 33 |
$previews = $args['previews'] ?? []; |
| 34 |
$buy_url = 'https://exeebit.com/phpinfo-wp#pricing'; |
| 35 |
$lic_url = admin_url('admin.php?page=phpinfowp-license'); |
| 36 |
?> |
| 37 |
<div class="phpinfowp-pro-page"> |
| 38 |
<div style=" |
| 39 |
max-width: 560px; |
| 40 |
margin: 48px auto; |
| 41 |
text-align: center; |
| 42 |
padding: 40px 32px; |
| 43 |
background: #fff; |
| 44 |
border: 1px solid #dde0e4; |
| 45 |
border-top: 4px solid #777BB3; |
| 46 |
border-radius: 6px; |
| 47 |
box-shadow: 0 2px 8px rgba(0,0,0,0.05); |
| 48 |
"> |
| 49 |
<!-- Icon + lock badge --> |
| 50 |
<div style="position:relative;display:inline-block;margin-bottom:20px;"> |
| 51 |
<span class="dashicons <?php echo esc_attr($icon); ?>" |
| 52 |
style="font-size:48px;width:48px;height:48px;color:#777BB3;opacity:.9;"></span> |
| 53 |
<span style=" |
| 54 |
position:absolute;bottom:-4px;right:-10px; |
| 55 |
background:#1d2327;color:#fff; |
| 56 |
font-size:9px;font-weight:700;letter-spacing:.5px; |
| 57 |
padding:2px 5px;border-radius:3px; |
| 58 |
line-height:1.5; |
| 59 |
"><?php _e('PRO', 'phpinfo-wp'); ?></span> |
| 60 |
</div> |
| 61 |
|
| 62 |
<h2 style="margin:0 0 8px;font-size:22px;font-weight:700;color:#1d2327;"> |
| 63 |
<?php echo esc_html($feature); ?> |
| 64 |
</h2> |
| 65 |
<p style="margin:0 0 24px;font-size:14px;color:#555;line-height:1.55;"> |
| 66 |
<?php echo esc_html($tagline); ?> |
| 67 |
</p> |
| 68 |
|
| 69 |
<?php if (!empty($previews)): ?> |
| 70 |
<!-- Skeleton data preview --> |
| 71 |
<div style=" |
| 72 |
background:#f6f7f7; |
| 73 |
border:1px solid #e5e7ea; |
| 74 |
border-radius:4px; |
| 75 |
padding:16px 20px; |
| 76 |
margin-bottom:24px; |
| 77 |
user-select:none; |
| 78 |
pointer-events:none; |
| 79 |
" aria-hidden="true"> |
| 80 |
<?php |
| 81 |
$skel_widths = [ ['50%', '20%'], ['65%', '15%'], ['40%', '25%'], ['55%', '20%'] ]; |
| 82 |
$i = 0; |
| 83 |
$count = count($previews); |
| 84 |
foreach ($previews as $row): |
| 85 |
$w1 = $skel_widths[$i % 4][0]; |
| 86 |
$w2 = $skel_widths[$i % 4][1]; |
| 87 |
$b_bot = (++$i === $count) ? 'none' : '1px solid #eee'; |
| 88 |
?> |
| 89 |
<div style="display:flex;justify-content:space-between;align-items:center;padding:10px 0;border-bottom:<?php echo $b_bot; ?>;"> |
| 90 |
<div style="height:11px; width:<?php echo $w1; ?>; background:#cbd5e1; border-radius:4px;"></div> |
| 91 |
<div style="height:11px; width:<?php echo $w2; ?>; background:#cbd5e1; border-radius:4px;"></div> |
| 92 |
</div> |
| 93 |
<?php endforeach; ?> |
| 94 |
</div> |
| 95 |
<p style="margin:-16px 0 20px;font-size:12px;color:#888;font-style:italic;"> |
| 96 |
↑ Sample data — unlock to see your real numbers |
| 97 |
</p> |
| 98 |
<?php endif; ?> |
| 99 |
|
| 100 |
<!-- CTAs --> |
| 101 |
<div style="display:flex;flex-direction:column;align-items:center;gap:10px;"> |
| 102 |
<a href="<?php echo esc_url($buy_url); ?>" target="_blank" rel="noopener" |
| 103 |
style=" |
| 104 |
display:inline-block;width:100%;max-width:280px; |
| 105 |
background:#777BB3;color:#fff; |
| 106 |
padding:11px 24px;border-radius:4px; |
| 107 |
font-size:14px;font-weight:600;text-decoration:none; |
| 108 |
box-sizing:border-box; |
| 109 |
"> |
| 110 |
Unlock <?php echo esc_html($feature); ?> — from $29/yr |
| 111 |
</a> |
| 112 |
<a href="<?php echo esc_url($lic_url); ?>" |
| 113 |
style="font-size:12.5px;color:#777;text-decoration:underline;"> |
| 114 |
I already have a license |
| 115 |
</a> |
| 116 |
</div> |
| 117 |
|
| 118 |
<p style="margin:20px 0 0;font-size:11.5px;color:#aaa;"> |
| 119 |
14-day refund · Instant delivery · All Pro features included |
| 120 |
</p> |
| 121 |
</div> |
| 122 |
</div> |
| 123 |
<?php |
| 124 |
} |
| 125 |
|
| 126 |
endif; |
| 127 |
|