social-sharing.php
47 lines
| 1 | <?php if ( isset( $options['thank-you']['sharing'] ) && $options['thank-you']['sharing'] === 'enabled' ) : ?> |
| 2 | <div class="social-sharing"> |
| 3 | <p class="instruction"> |
| 4 | <?php echo esc_html( $options['thank-you']['sharing_instruction'] ); ?> |
| 5 | </p> |
| 6 | <div class="btn-row"> |
| 7 | <!-- Use inline onclick listener to avoid popup blockers --> |
| 8 | <button class="give-btn social-btn facebook-btn" |
| 9 | onclick=" |
| 10 | // Retrieve and sanitize url to be shared |
| 11 | let url = parent.window.location.toString(); |
| 12 | if (window.Give.fn.getParameterByName('giveDonationAction', url)) { |
| 13 | url = window.Give.fn.removeURLParameter(url, 'giveDonationAction'); |
| 14 | url = window.Give.fn.removeURLParameter(url, 'payment-confirmation'); |
| 15 | url = window.Give.fn.removeURLParameter(url, 'payment-id'); |
| 16 | } |
| 17 | // Calculate new window position, based on parent window height/width |
| 18 | const top = parent.window.innerHeight / 2 - 365; |
| 19 | const left = parent.window.innerWidth / 2 - 280; |
| 20 | // Open new window with prompt for Facebook sharing |
| 21 | window.Give.share.fn.facebook(url); |
| 22 | return false; |
| 23 | "> |
| 24 | <?php esc_html_e( 'Share on Facebook', 'give' ); ?><i class="fab fa-facebook"></i> |
| 25 | </button> |
| 26 | <!-- Use inline onclick listener to avoid popup blockers --> |
| 27 | <button |
| 28 | class="give-btn social-btn twitter-btn" |
| 29 | onclick=" |
| 30 | // Retrieve and sanitize url to be shared |
| 31 | let url = parent.window.location.toString(); |
| 32 | if (window.Give.fn.getParameterByName('giveDonationAction', url)) { |
| 33 | url = window.Give.fn.removeURLParameter(url, 'giveDonationAction'); |
| 34 | url = window.Give.fn.removeURLParameter(url, 'payment-confirmation'); |
| 35 | url = window.Give.fn.removeURLParameter(url, 'payment-id'); |
| 36 | } |
| 37 | const text = `<?php echo $options['thank-you']['twitter_message']; ?>`; |
| 38 | // Open new window with prompt for Twitter sharing |
| 39 | window.Give.share.fn.twitter(url, text); |
| 40 | return false; |
| 41 | "> |
| 42 | <?php esc_html_e( 'Share on Twitter', 'give' ); ?><i class="fab fa-twitter"></i> |
| 43 | </button> |
| 44 | </div> |
| 45 | </div> |
| 46 | <?php endif; ?> |
| 47 |