| 1 |
<?php |
| 2 |
/** |
| 3 |
* Review request notice (free build only) — see src/Admin/ReviewRequest.php. |
| 4 |
* |
| 5 |
* Rendered on admin_notices on any admin screen, so it carries its own small |
| 6 |
* stylesheet and script: the plugin's admin assets are not loaded there. |
| 7 |
* One question, five stars, one button, two quiet ways out and a support link |
| 8 |
* for the people who are here because something is wrong. |
| 9 |
* |
| 10 |
* @var string $review_nonce |
| 11 |
*/ |
| 12 |
use FilterEverything\Filter\ReviewRequest; |
| 13 |
|
| 14 |
if (!defined('ABSPATH')) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
?> |
| 18 |
<div class="notice flrt-review-notice wp-exclude-emoji" id="flrt-review-notice" data-nonce="<?php echo esc_attr($review_nonce); ?>"> |
| 19 |
<div class="flrt-review-notice__stars" aria-hidden="true"> |
| 20 |
<?php for ($flrt_star = 0; $flrt_star < 5; $flrt_star++) : ?><a class="flrt-review-notice__star" href="<?php echo esc_url(ReviewRequest::REVIEW_URL); ?>" target="_blank" rel="noopener" data-flrt-review="rated">★</a><?php endfor; ?> |
| 21 |
</div> |
| 22 |
<div class="flrt-review-notice__body"> |
| 23 |
<strong class="flrt-review-notice__title"><?php echo esc_html__('Enjoying', 'filter-everything') . ' ' . esc_html__('Filter Everything?', 'filter-everything'); ?> 🤗</strong> |
| 24 |
<span class="flrt-review-notice__text"><?php echo wp_kses( __( 'Your review on WordPress.org <strong>keeps the free version alive</strong> — it takes a minute.', 'filter-everything' ), array( 'strong' => array() ) ); ?></span> |
| 25 |
<span class="flrt-review-notice__support"> |
| 26 |
<?php |
| 27 |
echo wp_kses( |
| 28 |
sprintf( |
| 29 |
/* translators: %1$s: opening link tag to the support forum, %2$s: closing link tag */ |
| 30 |
__("Something not working right? %1\$sContact support%2\$s — we'd rather fix it first.", 'filter-everything'), |
| 31 |
'<a href="' . esc_url(ReviewRequest::SUPPORT_URL) . '" target="_blank" rel="noopener">', |
| 32 |
'</a>' |
| 33 |
), |
| 34 |
['a' => ['href' => [], 'target' => [], 'rel' => []]] |
| 35 |
); |
| 36 |
?> |
| 37 |
</span> |
| 38 |
</div> |
| 39 |
<div class="flrt-review-notice__actions"> |
| 40 |
<a class="button button-primary flrt-review-notice__rate" href="<?php echo esc_url(ReviewRequest::REVIEW_URL); ?>" target="_blank" rel="noopener" data-flrt-review="rated"><?php echo esc_html__('Rate Filter Everything', 'filter-everything'); ?> ★</a> |
| 41 |
<span class="flrt-review-notice__links"> |
| 42 |
<button type="button" class="button-link" data-flrt-review="later"><?php echo esc_html__('Maybe later', 'filter-everything'); ?></button> |
| 43 |
<span class="flrt-review-notice__dot" aria-hidden="true">·</span> |
| 44 |
<button type="button" class="button-link" data-flrt-review="never"><?php echo esc_html__("Don't show this again", 'filter-everything'); ?></button> |
| 45 |
</span> |
| 46 |
<span class="flrt-review-notice__hint"><?php echo esc_html__('A WordPress.org account is needed to post a review.', 'filter-everything'); ?></span> |
| 47 |
</div> |
| 48 |
<button type="button" class="notice-dismiss flrt-review-notice__close" data-flrt-review="later"><span class="screen-reader-text"><?php echo esc_html__('Maybe later', 'filter-everything'); ?></span></button> |
| 49 |
</div> |
| 50 |
<style> |
| 51 |
.flrt-review-notice{position:relative;display:flex;align-items:center;flex-wrap:wrap;gap:12px 24px;padding:16px 44px 16px 20px;margin:15px 20px 12px 2px;border:1px solid #c3c4c7;border-left:4px solid #3858E9;border-radius:4px;background:#fff;box-shadow:0 1px 1px rgba(0,0,0,.04)} |
| 52 |
.flrt-review-notice__stars{display:flex;gap:2px;flex:none} |
| 53 |
.flrt-review-notice .flrt-review-notice__star{color:#3858E9;font-size:26px;line-height:1;text-decoration:none;border:0;box-shadow:none;transition:transform .15s ease} |
| 54 |
.flrt-review-notice .flrt-review-notice__star:hover,.flrt-review-notice .flrt-review-notice__star:focus{color:#3858E9;transform:scale(1.15);outline:none;box-shadow:none} |
| 55 |
.flrt-review-notice__body{flex:1 1 320px;min-width:0;display:flex;flex-direction:column;gap:3px;font-size:14px;line-height:1.5;color:#1F2028} |
| 56 |
.flrt-review-notice__text strong{font-weight:700;color:#1F2028;background:linear-gradient(transparent 58%,#DDE3FF 58%);padding:0 2px;border-radius:2px} |
| 57 |
.flrt-review-notice__title{font-size:16px;line-height:1.3;color:#1F2028} |
| 58 |
.flrt-review-notice__support{color:#646970;font-size:13px} |
| 59 |
.flrt-review-notice__actions{display:flex;flex-direction:column;align-items:flex-start;gap:6px;flex:none} |
| 60 |
.flrt-review-notice__rate.button{background:#3858E9;border-color:#3858E9;font-weight:600} |
| 61 |
.flrt-review-notice__rate.button:hover,.flrt-review-notice__rate.button:focus{background:#2f4bd0;border-color:#2f4bd0} |
| 62 |
.flrt-review-notice__links{font-size:13px;color:#646970} |
| 63 |
.flrt-review-notice__links .button-link{font-size:13px;color:#646970;text-decoration:underline} |
| 64 |
.flrt-review-notice__links .button-link:hover{color:#1F2028} |
| 65 |
.flrt-review-notice__dot{margin:0 6px} |
| 66 |
.flrt-review-notice__hint{font-size:12px;color:#8c8f94} |
| 67 |
.flrt-review-notice__close.notice-dismiss{position:absolute;top:8px;right:6px} |
| 68 |
</style> |
| 69 |
<script> |
| 70 |
( function () { |
| 71 |
var box = document.getElementById( 'flrt-review-notice' ); |
| 72 |
if ( ! box ) { return; } |
| 73 |
// The server already auto-snoozed on render, so hiding is always safe; |
| 74 |
// the request just records the explicit choice (later / never / rated). |
| 75 |
box.addEventListener( 'click', function ( e ) { |
| 76 |
var el = e.target.closest ? e.target.closest( '[data-flrt-review]' ) : null; |
| 77 |
if ( ! el ) { return; } |
| 78 |
var mode = el.getAttribute( 'data-flrt-review' ); |
| 79 |
var body = 'action=flrt_review_popup&nonce=' + encodeURIComponent( box.getAttribute( 'data-nonce' ) ) + '&mode=' + encodeURIComponent( mode ); |
| 80 |
var xhr = new XMLHttpRequest(); |
| 81 |
xhr.open( 'POST', window.ajaxurl || '/wp-admin/admin-ajax.php', true ); |
| 82 |
xhr.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8' ); |
| 83 |
xhr.send( body ); |
| 84 |
box.parentNode.removeChild( box ); |
| 85 |
} ); |
| 86 |
} )(); |
| 87 |
</script> |
| 88 |
|