| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
?> |
| 6 |
<div class="frm-review-notice frm-dismissible frm-card-item frm-compact-card-item frm-box-shadow-xxl"> |
| 7 |
<div class="frm-satisfied"> |
| 8 |
<?php |
| 9 |
FrmAppHelper::icon_by_class( |
| 10 |
'frmfont frm-flag frm_svg40 frm-review-notice-icon frm-text-success-500', |
| 11 |
array( |
| 12 |
'echo' => true, |
| 13 |
'aria-hidden' => 'true', |
| 14 |
) |
| 15 |
); |
| 16 |
?> |
| 17 |
<h3 class="frm-review-notice-title"><?php esc_html_e( 'Congratulations!', 'formidable' ); ?></h3> |
| 18 |
<p class="frm-review-notice-text"><span><?php echo esc_html( $title ); ?></span> <span><?php esc_html_e( 'Are you enjoying Formidable Forms?', 'formidable' ); ?></span></p> |
| 19 |
<div class="frm-flex frm-flex-center frm-gap-sm"> |
| 20 |
<a href="#" class="show-frm-feedback button frm-button-secondary" data-link="feedback"> |
| 21 |
<?php esc_html_e( 'Not Really', 'formidable' ); ?> |
| 22 |
</a> |
| 23 |
<a href="#" class="show-frm-feedback button frm-button-primary" data-link="review"> |
| 24 |
<?php esc_html_e( 'Yes, I do!', 'formidable' ); ?> |
| 25 |
</a> |
| 26 |
</div> |
| 27 |
</div> |
| 28 |
|
| 29 |
<div class="frm-review-request frm_hidden"> |
| 30 |
<?php |
| 31 |
FrmAppHelper::icon_by_class( |
| 32 |
'frmfont frm-star-feedback-icon frm_svg40 frm-review-notice-icon frm-text-warning-500', |
| 33 |
array( |
| 34 |
'echo' => true, |
| 35 |
'aria-hidden' => 'true', |
| 36 |
) |
| 37 |
); |
| 38 |
?> |
| 39 |
<h3 class="frm-review-notice-title"><?php esc_html_e( 'Awesome!', 'formidable' ); ?></h3> |
| 40 |
<p class="frm-review-notice-text"><?php esc_html_e( 'Could you do me a BIG favor and give Formidable Forms a review to help me grow my little business and boost our motivation?', 'formidable' ); ?></p> |
| 41 |
<div class="frm-review-notice-signature frm-flex frm-gap-xs"> |
| 42 |
<img src="<?php echo esc_url( FrmAppHelper::plugin_url() ); ?>/images/steph-wells.png" alt="<?php esc_attr_e( 'Steph Wells', 'formidable' ); ?>" /> |
| 43 |
<div class="frm-flex-col"> |
| 44 |
<span class="frm-font-medium frm-text-grey-900">Steph Wells</span> |
| 45 |
<span class="frm-text-xs"><?php esc_html_e( 'Co-Founder and CTO of Formidable Forms', 'formidable' ); ?><span> |
| 46 |
</div> |
| 47 |
</div> |
| 48 |
<div class="frm-flex frm-flex-center frm-gap-sm"> |
| 49 |
<a href="#" class="frm-dismiss-review-notice button frm-button-secondary" data-link="no" target="_blank" rel="noopener noreferrer"> |
| 50 |
<?php esc_html_e( 'Maybe Later', 'formidable' ); ?> |
| 51 |
</a> |
| 52 |
<a href="https://wordpress.org/support/plugin/formidable/reviews/?filter=5#new-post" class="frm-dismiss-review-notice frm-review-out button frm-button-primary" data-link="yes" target="_blank" rel="noopener"> |
| 53 |
<?php esc_html_e( 'Ok, you deserve it', 'formidable' ); ?> |
| 54 |
</a> |
| 55 |
</div> |
| 56 |
</div> |
| 57 |
|
| 58 |
<div class="frm-feedback-request frm_hidden"> |
| 59 |
<?php |
| 60 |
FrmAppHelper::icon_by_class( |
| 61 |
'frmfont frm-pencil-message-icon frm_svg40 frm-review-notice-icon frm-text-primary-500', |
| 62 |
array( |
| 63 |
'echo' => true, |
| 64 |
'aria-hidden' => 'true', |
| 65 |
) |
| 66 |
); |
| 67 |
?> |
| 68 |
<p class="frm-review-notice-text"><?php esc_html_e( 'Sorry to hear you aren\'t enjoying building with Formidable. We would love a chance to improve. Could you take a minute and let us know what we can do better?', 'formidable' ); ?></p> |
| 69 |
<div id="frmapi-feedback" class="frmapi-form" data-url="https://sandbox.formidableforms.com/api/wp-json/frm/v2/forms/feedback?return=html&exclude_script=jquery&exclude_style=formidable-css"> |
| 70 |
<span class="frm-wait frm_visible_spinner"></span> |
| 71 |
</div> |
| 72 |
</div> |
| 73 |
|
| 74 |
<a class="dismiss frm-dismiss-review-notice" aria-label="<?php esc_attr_e( 'Dismiss this notice', 'formidable' ); ?>" role="button"> |
| 75 |
<?php FrmAppHelper::icon_by_class( 'frmfont frm_close_icon' ); ?> |
| 76 |
</a> |
| 77 |
</div> |
| 78 |
|
| 79 |
<script type="text/javascript"> |
| 80 |
jQuery( document ).ready( function( $ ) { |
| 81 |
$( document ).on( |
| 82 |
'click', |
| 83 |
'.frm-dismiss-review-notice', |
| 84 |
function( event ) { |
| 85 |
if ( ! $( this ).hasClass( 'frm-review-out' ) ) { |
| 86 |
event.preventDefault(); |
| 87 |
} |
| 88 |
let link = $( this ).data( 'link' ); |
| 89 |
if ( typeof link === 'undefined' ) { |
| 90 |
link = 'no'; |
| 91 |
} |
| 92 |
|
| 93 |
frmDismissReview( link ); |
| 94 |
$( '.frm-review-notice' ).remove(); |
| 95 |
} |
| 96 |
); |
| 97 |
|
| 98 |
$( document ).on( 'click', '.frm-feedback-request button', () => frmDismissReview( 'done' ) ); |
| 99 |
|
| 100 |
$( '.show-frm-feedback' ).click( |
| 101 |
function( e ) { |
| 102 |
e.preventDefault(); |
| 103 |
const link = $( this ).data( 'link' ); |
| 104 |
const className = '.frm-' + link + '-request'; |
| 105 |
jQuery( '.frm-satisfied' ).hide(); |
| 106 |
jQuery( className ).show(); |
| 107 |
|
| 108 |
if ( className === '.frm-feedback-request' ) { |
| 109 |
frmapiGetData( $( '#frmapi-feedback' ) ); |
| 110 |
} |
| 111 |
} |
| 112 |
); |
| 113 |
} ); |
| 114 |
|
| 115 |
function frmDismissReview( link ) { |
| 116 |
jQuery.post( |
| 117 |
ajaxurl, |
| 118 |
{ |
| 119 |
action: 'frm_dismiss_review', |
| 120 |
link, |
| 121 |
nonce: '<?php echo esc_html( wp_create_nonce( 'frm_ajax' ) ); ?>' |
| 122 |
} |
| 123 |
); |
| 124 |
} |
| 125 |
|
| 126 |
function frmapiGetData( frmcont ) { |
| 127 |
jQuery.ajax({ |
| 128 |
dataType: 'json', |
| 129 |
url: frmcont.data( 'url' ), |
| 130 |
success: ( json ) => { |
| 131 |
const form = json.renderedHtml.replace( /<link\b[^>]*(formidableforms.css|action=frmpro_css)[^>]*>/gi, '' ); |
| 132 |
frmcont.html( form ); |
| 133 |
} |
| 134 |
}); |
| 135 |
} |
| 136 |
</script> |
| 137 |
|