| 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 |
<p> |
| 9 |
<?php echo esc_html( $title ); ?> |
| 10 |
<br/> |
| 11 |
<?php esc_html_e( 'Are you enjoying Formidable Forms?', 'formidable' ); ?> |
| 12 |
</p> |
| 13 |
<a href="#" class="show-frm-feedback button frm-button-secondary" data-link="feedback"> |
| 14 |
<?php esc_html_e( 'Not Really', 'formidable' ); ?> |
| 15 |
</a> |
| 16 |
<a href="#" class="show-frm-feedback button frm-button-primary" data-link="review"> |
| 17 |
<?php esc_html_e( 'Yes!', 'formidable' ); ?> |
| 18 |
</a> |
| 19 |
</div> |
| 20 |
<div class="frm-review-request frm_hidden"> |
| 21 |
<p><?php esc_html_e( 'Awesome! 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> |
| 22 |
<p>- Steph Wells<br/> |
| 23 |
<span><?php esc_html_e( 'Co-Founder and CTO of Formidable Forms', 'formidable' ); ?><span> |
| 24 |
</p> |
| 25 |
<a href="#" class="frm-dismiss-review-notice button frm-button-secondary" data-link="no" target="_blank" rel="noopener noreferrer"> |
| 26 |
<?php esc_html_e( 'No thanks, maybe later', 'formidable' ); ?> |
| 27 |
</a> |
| 28 |
<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"> |
| 29 |
<?php esc_html_e( 'Ok, you deserve it', 'formidable' ); ?> |
| 30 |
</a> |
| 31 |
<br/> |
| 32 |
<a href="#" class="frm-dismiss-review-notice" data-link="done" target="_blank" rel="noopener noreferrer"> |
| 33 |
<?php esc_html_e( 'I already did', 'formidable' ); ?> |
| 34 |
</a> |
| 35 |
</div> |
| 36 |
<div class="frm-feedback-request frm_hidden"> |
| 37 |
<p><?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> |
| 38 |
|
| 39 |
<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"> |
| 40 |
<span class="frm-wait frm_visible_spinner"></span> |
| 41 |
</div> |
| 42 |
</div> |
| 43 |
<a class="dismiss frm-dismiss-review-notice" aria-label="<?php esc_attr_e( 'Dismiss this notice', 'formidable' ); ?>" role="button"> |
| 44 |
<?php FrmAppHelper::icon_by_class( 'frmfont frm_close_icon' ); ?> |
| 45 |
</a> |
| 46 |
</div> |
| 47 |
<script type="text/javascript"> |
| 48 |
jQuery( document ).ready( function( $ ) { |
| 49 |
$( document ).on( |
| 50 |
'click', |
| 51 |
'.frm-dismiss-review-notice', |
| 52 |
function( event ) { |
| 53 |
if ( ! $( this ).hasClass( 'frm-review-out' ) ) { |
| 54 |
event.preventDefault(); |
| 55 |
} |
| 56 |
let link = $( this ).data( 'link' ); |
| 57 |
if ( typeof link === 'undefined' ) { |
| 58 |
link = 'no'; |
| 59 |
} |
| 60 |
|
| 61 |
frmDismissReview( link ); |
| 62 |
$( '.frm-review-notice' ).remove(); |
| 63 |
} |
| 64 |
); |
| 65 |
|
| 66 |
$( document ).on( 'click', '.frm-feedback-request button', () => frmDismissReview( 'done' ) ); |
| 67 |
|
| 68 |
$( '.show-frm-feedback' ).click( |
| 69 |
function( e ) { |
| 70 |
e.preventDefault(); |
| 71 |
const link = $( this ).data( 'link' ); |
| 72 |
const className = '.frm-' + link + '-request'; |
| 73 |
jQuery( '.frm-satisfied' ).hide(); |
| 74 |
jQuery( className ).show(); |
| 75 |
|
| 76 |
if ( className === '.frm-feedback-request' ) { |
| 77 |
frmapiGetData( $( '#frmapi-feedback' ) ); |
| 78 |
} |
| 79 |
} |
| 80 |
); |
| 81 |
} ); |
| 82 |
|
| 83 |
function frmDismissReview( link ) { |
| 84 |
jQuery.post( |
| 85 |
ajaxurl, |
| 86 |
{ |
| 87 |
action: 'frm_dismiss_review', |
| 88 |
link, |
| 89 |
nonce: '<?php echo esc_html( wp_create_nonce( 'frm_ajax' ) ); ?>' |
| 90 |
} |
| 91 |
); |
| 92 |
} |
| 93 |
|
| 94 |
function frmapiGetData( frmcont ) { |
| 95 |
jQuery.ajax({ |
| 96 |
dataType: 'json', |
| 97 |
url: frmcont.data( 'url' ), |
| 98 |
success: ( json ) => { |
| 99 |
const form = json.renderedHtml.replace( /<link\b[^>]*(formidableforms.css|action=frmpro_css)[^>]*>/gi, '' ); |
| 100 |
frmcont.html( form ); |
| 101 |
} |
| 102 |
}); |
| 103 |
} |
| 104 |
</script> |
| 105 |
|