PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
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 / TestData / Addons / ManualDonations / ManualDonations.php

ManualDonations.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/TestData/Addons/ManualDonations/ManualDonations.php

47 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\TestData\Addons\ManualDonations;
4
5 use Exception;
6 use Give\TestData\Framework\MetaRepository;
7
8 /**
9 * Class ManualDonations
10 * @package Give\TestData\ManualDonations
11 *
12 * @since 2.15.0 update class code to maintain PHP 5.6 compatibility
13 */
14 class ManualDonations
15 {
16
17 const GATEWAY = 'manual_donation';
18
19 /**
20 * @param int $donationID
21 * @param array $donation
22 */
23 public function updateDonationMeta($donationID, $donation)
24 {
25 global $wpdb;
26
27 // Check gateway
28 if ($donation['payment_gateway'] !== self::GATEWAY) {
29 return;
30 }
31
32 // Start DB transaction
33 $wpdb->query('START TRANSACTION');
34
35 try {
36 // Update donation meta
37 $metaRepository = new MetaRepository('give_donationmeta', 'donation_id');
38 $metaRepository->persist($donationID, ['_give_manually_added_donation' => 1]);
39
40 $wpdb->query('COMMIT');
41 } catch (Exception $e) {
42 $wpdb->query('ROLLBACK');
43 }
44 }
45
46 }
47