PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.8.1
GiveWP – Donation Plugin and Fundraising Platform v4.16.8.1
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / Helpers / Frontend / Shortcode.php

Shortcode.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.8.1, at src/Helpers/Frontend/Shortcode.php

53 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 /**
30 * @since 3.4.0
31 */
32 public static function isValidDonation(int $donationId): bool
33 {
34 return ! empty($donationId) && 'give_payment' === get_post_type($donationId);
35 }
36
37 /**
38 * @since 3.4.0
39 */
40 public static function isValidForm(int $formId): bool
41 {
42 return ! empty($formId) && 'give_forms' === get_post_type($formId);
43 }
44
45 /**
46 * @since 3.4.0
47 */
48 public static function isPublishedForm(int $formId): bool
49 {
50 return self::isValidForm($formId) && 'publish' === get_post_status($formId);
51 }
52 }
53