Shortcode.php
29 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Helpers\Frontend; |
| 4 | |
| 5 | class Shortcode |
| 6 | { |
| 7 | /** |
| 8 | * Get give_receipt shortcode with attributes from confirmation page. |
| 9 | * |
| 10 | * @since 2.7.0 |
| 11 | * @return string |
| 12 | */ |
| 13 | public static function getReceiptShortcodeFromConfirmationPage() |
| 14 | { |
| 15 | $post = get_post(give_get_option('success_page', 0)); |
| 16 | $content = $post->post_content; |
| 17 | |
| 18 | if ( ! empty($content)) { |
| 19 | preg_match('/\[give_receipt(.*?)]/i', $content, $matches); |
| 20 | |
| 21 | if (isset($matches[0])) { |
| 22 | return $matches[0]; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | return ''; |
| 27 | } |
| 28 | } |
| 29 |