Changeset 3332990
- Timestamp:
- 07/23/2025 02:12:33 PM (7 months ago)
- Location:
- give-double-the-donation
- Files:
-
- 8 added
- 2 deleted
- 30 edited
- 1 copied
-
tags/2.1.0 (copied) (copied from give-double-the-donation/trunk)
-
tags/2.1.0/build/frontend.asset.php (modified) (1 diff)
-
tags/2.1.0/build/frontend.js (modified) (1 diff)
-
tags/2.1.0/changelog.txt (modified) (1 diff)
-
tags/2.1.0/give-double-the-donation.php (modified) (2 diffs)
-
tags/2.1.0/readme.txt (modified) (5 diffs)
-
tags/2.1.0/src/DoubleTheDonation/API (added)
-
tags/2.1.0/src/DoubleTheDonation/API/REST (added)
-
tags/2.1.0/src/DoubleTheDonation/API/REST/CompanyMatching.php (added)
-
tags/2.1.0/src/DoubleTheDonation/AddonServiceProvider.php (modified) (4 diffs)
-
tags/2.1.0/src/DoubleTheDonation/Assets.php (modified) (4 diffs)
-
tags/2.1.0/src/DoubleTheDonation/FormExtension/Actions/ConvertBlockToField.php (modified) (2 diffs)
-
tags/2.1.0/src/DoubleTheDonation/FormExtension/Actions/DisplayField.php (added)
-
tags/2.1.0/src/DoubleTheDonation/FormExtension/Actions/DisplayFieldLabel.php (deleted)
-
tags/2.1.0/src/DoubleTheDonation/FormExtension/Actions/FieldScope/HandleData.php (modified) (3 diffs)
-
tags/2.1.0/src/DoubleTheDonation/FormExtension/ServiceProvider.php (modified) (2 diffs)
-
tags/2.1.0/src/DoubleTheDonation/Payment.php (modified) (2 diffs)
-
tags/2.1.0/src/DoubleTheDonation/resources/js/frontend/give-double-the-donation.js (modified) (2 diffs)
-
tags/2.1.0/src/DoubleTheDonation/resources/views/dtd-receipt.php (modified) (2 diffs)
-
tags/2.1.0/vendor/autoload.php (modified) (1 diff)
-
tags/2.1.0/vendor/composer/InstalledVersions.php (modified) (4 diffs)
-
trunk/build/frontend.asset.php (modified) (1 diff)
-
trunk/build/frontend.js (modified) (1 diff)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/give-double-the-donation.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (5 diffs)
-
trunk/src/DoubleTheDonation/API (added)
-
trunk/src/DoubleTheDonation/API/REST (added)
-
trunk/src/DoubleTheDonation/API/REST/CompanyMatching.php (added)
-
trunk/src/DoubleTheDonation/AddonServiceProvider.php (modified) (4 diffs)
-
trunk/src/DoubleTheDonation/Assets.php (modified) (4 diffs)
-
trunk/src/DoubleTheDonation/FormExtension/Actions/ConvertBlockToField.php (modified) (2 diffs)
-
trunk/src/DoubleTheDonation/FormExtension/Actions/DisplayField.php (added)
-
trunk/src/DoubleTheDonation/FormExtension/Actions/DisplayFieldLabel.php (deleted)
-
trunk/src/DoubleTheDonation/FormExtension/Actions/FieldScope/HandleData.php (modified) (3 diffs)
-
trunk/src/DoubleTheDonation/FormExtension/ServiceProvider.php (modified) (2 diffs)
-
trunk/src/DoubleTheDonation/Payment.php (modified) (2 diffs)
-
trunk/src/DoubleTheDonation/resources/js/frontend/give-double-the-donation.js (modified) (2 diffs)
-
trunk/src/DoubleTheDonation/resources/views/dtd-receipt.php (modified) (2 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/InstalledVersions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
give-double-the-donation/tags/2.1.0/build/frontend.asset.php
r3072620 r3332990 1 <?php return array('dependencies' => array(), 'version' => ' 95b1e6ad157050134353');1 <?php return array('dependencies' => array(), 'version' => 'cb2ce59061ec431a0631'); -
give-double-the-donation/tags/2.1.0/build/frontend.js
r3072620 r3332990 1 (()=>{if(window.doublethedonation){function e(){document.querySelectorAll(".dd-company-name-input").forEach((e=>{e.hasAttribute("data-doublethedonation-widget-id")|| window.doublethedonation.plugin.load_streamlined_input(e)}))}document.addEventListener("give_gateway_loaded",e),e()}})();1 (()=>{if(window.doublethedonation){function e(){document.querySelectorAll(".dd-company-name-input").forEach((e=>{e.hasAttribute("data-doublethedonation-widget-id")||(window.doublethedonation.plugin.load_streamlined_input(e),e.addEventListener("change",(()=>{const t=e.dataset.donationId,n=e.dataset.receiptId;window.setTimeout((async()=>{const e=document.querySelector('[name="doublethedonation_company_id"]').value,o=document.querySelector('[name="doublethedonation_company_name"]').value,d=document.querySelector('[name="doublethedonation_entered_text"]').value;await fetch(DDCONF.GIVE_ENDPOINT+t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({companyId:e,companyName:o,enteredText:d,receiptId:n})}),document.querySelectorAll(".wrongcompany a")?.forEach((e=>{e.addEventListener("click",(()=>{fetch(DDCONF.GIVE_ENDPOINT+t+`?receiptId=${n}`,{method:"DELETE"})}))}))}),500)})))}))}document.addEventListener("give_gateway_loaded",e),document.addEventListener("DOMContentLoaded",e)}})(); -
give-double-the-donation/tags/2.1.0/changelog.txt
r3207135 r3332990 1 1 *** Give - Double the Donation changelog *** 2 3 2025-07-23 - version 2.1.0 4 - New: Added compatibility with recurring donations 5 - New: Added additional company match field to the donation confirmation page 2 6 3 7 2024-12-12 - version 2.0.2 -
give-double-the-donation/tags/2.1.0/give-double-the-donation.php
r3207135 r3332990 4 4 * Plugin URI: https://givewp.com/addons/give-double-the-donation/ 5 5 * Description: Easily integrate with the Double the Donation employer matching platform. 6 * Version: 2. 0.26 * Version: 2.1.0 7 7 * Author: GiveWP 8 * Requires at least: 6. 38 * Requires at least: 6.6 9 9 * Requires PHP: 7.2 10 10 * Author URI: https://givewp.com/ … … 26 26 27 27 // Versions 28 define( 'GIVE_DTD_VERSION', '2. 0.2' );28 define( 'GIVE_DTD_VERSION', '2.1.0' ); 29 29 define( 'GIVE_DTD_MIN_GIVE_VERSION', '3.8.0' ); 30 30 -
give-double-the-donation/tags/2.1.0/readme.txt
r3207135 r3332990 3 3 Donate link: https://givewp.com/ 4 4 Tags: givewp, double the donation, employer matching, company matching donation, employer matching donations 5 Requires at least: 6. 36 Tested up to: 6. 75 Requires at least: 6.6 6 Tested up to: 6.8 7 7 Requires PHP: 7.2 8 Stable tag: 2. 0.28 Stable tag: 2.1.0 9 9 Requires Give: 3.8.0 10 10 License: GPLv3 … … 17 17 Empower your GiveWP donors to have their company match their donations with the most powerful Company Matching platform: Double the Donation. 18 18 19 With this GiveWP add-on, simply add your Double the Donation API keys into the settings, then each of your forms can be enabled to accept company matching. 19 With this GiveWP add-on, simply add your Double the Donation API keys into the settings, then each of your forms can be enabled to accept company matching. 20 20 21 21 **ABOUT DOUBLE THE DONATION:** 22 Automate your matching gift fundraising with the industry-leading solution from Double the Donation. Double the Donation provides nonprofits with tools to identify match-eligible donors, drive matches to completion, and gain actionable insights. Our unique integration with GiveWP integrates directly into your donation forms, to capture employment information and follow up appropriately with donors about matching gifts. 22 Automate your matching gift fundraising with the industry-leading solution from Double the Donation. Double the Donation provides nonprofits with tools to identify match-eligible donors, drive matches to completion, and gain actionable insights. Our unique integration with GiveWP integrates directly into your donation forms, to capture employment information and follow up appropriately with donors about matching gifts. 23 23 24 24 **ABOUT OUR FREE ADD-ONS** … … 31 31 = Minimum Requirements = 32 32 33 * An active subscription to Double the Donation. 34 * WordPress 6. 3or greater33 * An active subscription to Double the Donation. 34 * WordPress 6.6 or greater 35 35 * PHP version 7.2 or greater 36 36 * MySQL version 5.7 or greater … … 58 58 The companies listed in the Double the Donation dropdown all registered with Double the Donation to provide their employees this opportunity. If your company does not appear there, then most likely they have not yet applied with Double the Donation. You can submit on their behalf, or [send them here to apply](https://doublethedonation.com/matching-gift-database/new-companies-with-matching-gift-programs/). 59 59 60 = I set my company to match, what happens next? = 60 = I set my company to match, what happens next? = 61 61 Your company will get an email and you will as well with next steps to follow. If you have any trouble with this process, contact [Double the Donation directly here](https://support.doublethedonation.com/portal/en/home). 62 62 63 == Screenshots == 63 == Screenshots == 64 64 65 1. The company search is powered by Double the Donation. It's fast and intuitive for your donors. 65 1. The company search is powered by Double the Donation. It's fast and intuitive for your donors. 66 66 67 67 2. Integrating Double the Donation with GiveWP is as simple as inserting your API keys in the settings fields. … … 70 70 71 71 == Changelog == 72 73 = 2.1.0: July 23rd, 2025 = 74 * New: Added compatibility with recurring donations 75 * New: Added additional company match field to the donation confirmation page 72 76 73 77 = 2.0.2: December 12th, 2024 = -
give-double-the-donation/tags/2.1.0/src/DoubleTheDonation/AddonServiceProvider.php
r3207135 r3332990 3 3 namespace GiveDoubleTheDonation\DoubleTheDonation; 4 4 5 use Give\Donations\Models\Donation; 5 6 use Give\Helpers\Hooks; 6 7 use Give\ServiceProviders\ServiceProvider; … … 10 11 use GiveDoubleTheDonation\Addon\License; 11 12 use GiveDoubleTheDonation\DoubleTheDonation\Actions\CheckCredentials; 13 use GiveDoubleTheDonation\DoubleTheDonation\API\REST\CompanyMatching; 12 14 use GiveDoubleTheDonation\DoubleTheDonation\Helpers\SettingsPage as SettingsPageRegister; 13 15 … … 38 40 Hooks::addAction('give_donation_form_after_email', DonationForm::class, 'employerMatchField'); 39 41 40 // handle v2 forms stuff 41 if (isset($_POST) && ! isset($_POST['dtd'])) { 42 Hooks::addAction('give_insert_payment', Payment::class, 'addPaymentMeta', 10, 2); 43 Hooks::addAction('give_insert_payment', Payment::class, 'addDonationToDTD', 11, 2); 44 } 42 add_action('give_insert_payment', function($payment_id, $payment_data) { 43 // handle for v2 forms (v3 forms uses field scope) 44 if (isset($_POST) && !isset($_POST['dtd'])) { 45 give(Payment::class)->addPaymentMeta($payment_id, $payment_data); 46 47 $donation = Donation::find((int)$payment_id); 48 49 // handle for single donations only 50 if ($donation->type->isSingle()) { 51 give(Payment::class)->addDonationToDTD($payment_id, $payment_data); 52 } 53 } 54 }); 55 56 /** 57 * @since 2.1.0 add support for recurring donations 58 */ 59 Hooks::addAction('give_recurring_record_payment', Payment::class, 'addDonationToDTD', 10, 2); 45 60 46 61 // Show Receipt info … … 89 104 private function loadFrontend() 90 105 { 106 // @since 2.1.0 107 Hooks::addAction('rest_api_init', CompanyMatching::class); 108 91 109 // Load front-end assets. 92 110 Hooks::addAction('wp_enqueue_scripts', Assets::class, 'loadFrontendAssets'); 111 Hooks::addAction('givewp_donation_confirmation_receipt_showing', Assets::class, 'loadReceiptScripts'); 93 112 } 94 113 } -
give-double-the-donation/tags/2.1.0/src/DoubleTheDonation/Assets.php
r3072620 r3332990 1 1 <?php 2 2 3 namespace GiveDoubleTheDonation\DoubleTheDonation; 3 4 … … 8 9 * @copyright Copyright (c) 2020, GiveWP 9 10 */ 10 class Assets { 11 class Assets 12 { 11 13 12 /** 13 * Load add-on backend assets. 14 * 15 * @since 1.0.0 16 * @return void 17 */ 18 public static function loadBackendAssets() { 14 /** 15 * Load add-on backend assets. 16 * 17 * @since 1.0.0 18 * @return void 19 */ 20 public static function loadBackendAssets() 21 { 19 22 $assets = require(GIVE_DTD_DIR . 'build/backend.asset.php'); 20 23 21 wp_enqueue_script(22 'give-double-the-donation-script-backend',24 wp_enqueue_script( 25 'give-double-the-donation-script-backend', 23 26 GIVE_DTD_URL . 'build/backend.js', 24 27 $assets['dependencies'], 25 28 $assets['version'], 26 true27 );28 }29 true 30 ); 31 } 29 32 30 /** 31 * Load add-on front-end assets. 32 * 33 * @since 1.0.0 34 * @return void 35 */ 36 public static function loadFrontendAssets() { 33 /** 34 * Load add-on front-end assets. 35 * 36 * @since 1.0.0 37 * @return void 38 */ 39 public static function loadFrontendAssets() 40 { 37 41 $assets = require(GIVE_DTD_DIR . 'build/frontend.asset.php'); 38 42 … … 40 44 41 45 wp_enqueue_script( 42 'give-double-the-donation-script',43 'https://doublethedonation.com/api/js/ddplugin.js',44 []45 );46 'give-double-the-donation-script', 47 'https://doublethedonation.com/api/js/ddplugin.js', 48 [] 49 ); 46 50 47 wp_enqueue_style(48 'give-double-the-donation-style',49 'https://doublethedonation.com/api/css/ddplugin.css',50 []51 );51 wp_enqueue_style( 52 'give-double-the-donation-style', 53 'https://doublethedonation.com/api/css/ddplugin.css', 54 [] 55 ); 52 56 53 57 wp_enqueue_script( … … 56 60 $assets['dependencies'], 57 61 $assets['version'], 58 true 59 ); 60 } 62 true 63 ); 64 } 65 66 /** 67 * @since 2.1.0 68 */ 69 public function loadReceiptScripts() 70 { 71 if ($dtdPublicKey = give_get_option('public_dtd_key')) { 72 $this->loadFrontendAssets(); 73 74 wp_register_script('givewp-dtd-receipt-script', null); 75 wp_add_inline_script( 76 'givewp-dtd-receipt-script', 77 sprintf("var DDCONF = {'API_KEY': '%s', 'GIVE_ENDPOINT': '%s'}", $dtdPublicKey, rest_url('givewp/dtd/donation/')), 78 'before' 79 ); 80 wp_enqueue_script('givewp-dtd-receipt-script', null, ['give-double-the-donation-script']); 81 } 82 } 61 83 } -
give-double-the-donation/tags/2.1.0/src/DoubleTheDonation/FormExtension/Actions/ConvertBlockToField.php
r3207135 r3332990 3 3 namespace GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Actions; 4 4 5 use Give\Donations\Models\Donation;6 5 use Give\Framework\Blocks\BlockModel; 7 6 use Give\Framework\FieldsAPI\Contracts\Node; 8 7 use Give\Framework\FieldsAPI\Exceptions\EmptyNameException; 9 use GiveDoubleTheDonation\Addon\View;10 8 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Actions\FieldScope\HandleData; 11 9 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Field as DoubleTheDonationField; … … 30 28 ->showInReceipt() 31 29 ->receiptLabel(__('Company Matching', 'give-double-the-donation')) 32 ->receiptValue(function(DoubleTheDonationField $field, Donation $donation) {33 return View::load('dtd-receipt', [34 'donation' => $donation,35 ]);36 })37 30 ->tap(function (DoubleTheDonationField $field) use ($block) { 38 31 $field -
give-double-the-donation/tags/2.1.0/src/DoubleTheDonation/FormExtension/Actions/FieldScope/HandleData.php
r3207135 r3332990 54 54 * Save payment meta 55 55 * 56 * @since 2.1.0 update visibility 56 57 * @since 2.0.0 57 58 */ 58 p rivatefunction save(array $companyData, Donation $donation)59 public function save(array $companyData, Donation $donation) 59 60 { 60 61 foreach ($companyData as $name => $value) { … … 82 83 * Send data to DTD 360match pro 83 84 * 85 * @since 2.1.0 update visibility 84 86 * @since 2.0.2 85 87 */ 86 p rivatefunction send(array $companyData, Donation $donation): void88 public function send(array $companyData, Donation $donation): void 87 89 { 88 90 if ( ! $dtdPublicKey = give_get_option('public_dtd_key')) { … … 132 134 ]); 133 135 } 136 137 /** 138 * Remove payment meta added on donation confirmation page 139 * 140 * @since 2.1.0 141 */ 142 public function remove(Donation $donation) 143 { 144 $fields = [ 145 'company_id', 146 'company_name', 147 'entered_text' 148 ]; 149 150 foreach ($fields as $name => $value) { 151 give_delete_meta( 152 $donation->id, 153 'doublethedonation_' . $name, 154 ); 155 } 156 157 give_delete_meta( 158 $donation->id, 159 '_give_donation_company', 160 ); 161 162 give()->donor_meta->delete_meta( 163 $donation->donorId, 164 '_give_donor_company', 165 ); 166 } 134 167 } -
give-double-the-donation/tags/2.1.0/src/DoubleTheDonation/FormExtension/ServiceProvider.php
r3072620 r3332990 6 6 use Give\ServiceProviders\ServiceProvider as ServiceProviderInterface; 7 7 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Actions\ConvertBlockToField; 8 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Actions\DisplayField Label;8 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Actions\DisplayField; 9 9 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Actions\LoadAssets; 10 10 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Email\EmailTags; … … 31 31 32 32 Hooks::addFilter('givewp_donation_form_block_render_givewp/dtd', ConvertBlockToField::class, '__invoke', 10, 4); 33 Hooks::addFilter('givewp_donation_confirmation_page_field_ label_for_dtd', DisplayFieldLabel::class, '__invoke', 10, 3);33 Hooks::addFilter('givewp_donation_confirmation_page_field_value_for_dtd', DisplayField::class, 'value', 10, 3); 34 34 35 35 Hooks::addFilter('give_email_tags', EmailTags::class, 'register'); -
give-double-the-donation/tags/2.1.0/src/DoubleTheDonation/Payment.php
r3207135 r3332990 2 2 3 3 namespace GiveDoubleTheDonation\DoubleTheDonation; 4 5 use Give\Donations\Models\Donation; 4 6 5 7 class Payment { … … 52 54 */ 53 55 public function addDonationToDTD( $payment_id, $payment_data ) { 54 55 56 // API Key check 56 57 $dtdPublicKey = give_get_option( 'public_dtd_key', false ); -
give-double-the-donation/tags/2.1.0/src/DoubleTheDonation/resources/js/frontend/give-double-the-donation.js
r2413638 r3332990 4 4 if ( ! input.hasAttribute( 'data-doublethedonation-widget-id' ) ) { 5 5 window.doublethedonation.plugin.load_streamlined_input( input ); 6 7 input.addEventListener('change', () => { 8 const donationId = input.dataset.donationId; 9 const receiptId = input.dataset.receiptId; 10 // do we have an event from DTD we can use?? 11 window.setTimeout(async () => { 12 const companyId = document.querySelector('[name="doublethedonation_company_id"]').value; 13 const companyName = document.querySelector('[name="doublethedonation_company_name"]').value; 14 const enteredText = document.querySelector('[name="doublethedonation_entered_text"]').value; 15 16 const response = await fetch(DDCONF.GIVE_ENDPOINT + donationId, { 17 method: 'POST', 18 headers: { 19 'Content-Type': 'application/json', 20 }, 21 body: JSON.stringify({ 22 companyId, 23 companyName, 24 enteredText, 25 receiptId 26 }), 27 }); 28 29 // select different company 30 document.querySelectorAll('.wrongcompany a')?.forEach((link) => { 31 link.addEventListener('click', () => { 32 const response = fetch(DDCONF.GIVE_ENDPOINT + donationId + `?receiptId=${receiptId}`, { 33 method: 'DELETE', 34 }); 35 }); 36 }); 37 }, 500) 38 }); 6 39 } 7 40 } ); … … 9 42 10 43 document.addEventListener( 'give_gateway_loaded', initializePlugin ); 11 12 initializePlugin(); 44 document.addEventListener('DOMContentLoaded', initializePlugin); 13 45 } -
give-double-the-donation/tags/2.1.0/src/DoubleTheDonation/resources/views/dtd-receipt.php
r3207135 r3332990 6 6 /** 7 7 * @var Donation $donation 8 * @var string $receiptId 8 9 */ 9 10 … … 11 12 12 13 if ( ! $companyId) { 14 printf('<div class="dd-company-name-input" data-donation-id="%s" data-receipt-id="%s"></div>', $donation->id, $receiptId); 13 15 return; 14 16 } -
give-double-the-donation/tags/2.1.0/vendor/autoload.php
r3072620 r3332990 15 15 } 16 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 17 throw new RuntimeException($err); 21 18 } 22 19 -
give-double-the-donation/tags/2.1.0/vendor/composer/InstalledVersions.php
r3207135 r3332990 28 28 { 29 29 /** 30 * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to 31 * @internal 32 */ 33 private static $selfDir = null; 34 35 /** 30 36 * @var mixed[]|null 31 37 * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null 32 38 */ 33 39 private static $installed; 40 41 /** 42 * @var bool 43 */ 44 private static $installedIsLocalDir; 34 45 35 46 /** … … 310 321 self::$installed = $data; 311 322 self::$installedByVendor = array(); 323 324 // when using reload, we disable the duplicate protection to ensure that self::$installed data is 325 // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, 326 // so we have to assume it does not, and that may result in duplicate data being returned when listing 327 // all installed packages for example 328 self::$installedIsLocalDir = false; 329 } 330 331 /** 332 * @return string 333 */ 334 private static function getSelfDir() 335 { 336 if (self::$selfDir === null) { 337 self::$selfDir = strtr(__DIR__, '\\', '/'); 338 } 339 340 return self::$selfDir; 312 341 } 313 342 … … 326 355 327 356 if (self::$canGetVendors) { 357 $selfDir = self::getSelfDir(); 328 358 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 359 $vendorDir = strtr($vendorDir, '\\', '/'); 329 360 if (isset(self::$installedByVendor[$vendorDir])) { 330 361 $installed[] = self::$installedByVendor[$vendorDir]; … … 334 365 self::$installedByVendor[$vendorDir] = $required; 335 366 $installed[] = $required; 336 if (s trtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {367 if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { 337 368 self::$installed = $required; 338 $copiedLocalDir = true;369 self::$installedIsLocalDir = true; 339 370 } 371 } 372 if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { 373 $copiedLocalDir = true; 340 374 } 341 375 } -
give-double-the-donation/trunk/build/frontend.asset.php
r3072620 r3332990 1 <?php return array('dependencies' => array(), 'version' => ' 95b1e6ad157050134353');1 <?php return array('dependencies' => array(), 'version' => 'cb2ce59061ec431a0631'); -
give-double-the-donation/trunk/build/frontend.js
r3072620 r3332990 1 (()=>{if(window.doublethedonation){function e(){document.querySelectorAll(".dd-company-name-input").forEach((e=>{e.hasAttribute("data-doublethedonation-widget-id")|| window.doublethedonation.plugin.load_streamlined_input(e)}))}document.addEventListener("give_gateway_loaded",e),e()}})();1 (()=>{if(window.doublethedonation){function e(){document.querySelectorAll(".dd-company-name-input").forEach((e=>{e.hasAttribute("data-doublethedonation-widget-id")||(window.doublethedonation.plugin.load_streamlined_input(e),e.addEventListener("change",(()=>{const t=e.dataset.donationId,n=e.dataset.receiptId;window.setTimeout((async()=>{const e=document.querySelector('[name="doublethedonation_company_id"]').value,o=document.querySelector('[name="doublethedonation_company_name"]').value,d=document.querySelector('[name="doublethedonation_entered_text"]').value;await fetch(DDCONF.GIVE_ENDPOINT+t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({companyId:e,companyName:o,enteredText:d,receiptId:n})}),document.querySelectorAll(".wrongcompany a")?.forEach((e=>{e.addEventListener("click",(()=>{fetch(DDCONF.GIVE_ENDPOINT+t+`?receiptId=${n}`,{method:"DELETE"})}))}))}),500)})))}))}document.addEventListener("give_gateway_loaded",e),document.addEventListener("DOMContentLoaded",e)}})(); -
give-double-the-donation/trunk/changelog.txt
r3207135 r3332990 1 1 *** Give - Double the Donation changelog *** 2 3 2025-07-23 - version 2.1.0 4 - New: Added compatibility with recurring donations 5 - New: Added additional company match field to the donation confirmation page 2 6 3 7 2024-12-12 - version 2.0.2 -
give-double-the-donation/trunk/give-double-the-donation.php
r3207135 r3332990 4 4 * Plugin URI: https://givewp.com/addons/give-double-the-donation/ 5 5 * Description: Easily integrate with the Double the Donation employer matching platform. 6 * Version: 2. 0.26 * Version: 2.1.0 7 7 * Author: GiveWP 8 * Requires at least: 6. 38 * Requires at least: 6.6 9 9 * Requires PHP: 7.2 10 10 * Author URI: https://givewp.com/ … … 26 26 27 27 // Versions 28 define( 'GIVE_DTD_VERSION', '2. 0.2' );28 define( 'GIVE_DTD_VERSION', '2.1.0' ); 29 29 define( 'GIVE_DTD_MIN_GIVE_VERSION', '3.8.0' ); 30 30 -
give-double-the-donation/trunk/readme.txt
r3207135 r3332990 3 3 Donate link: https://givewp.com/ 4 4 Tags: givewp, double the donation, employer matching, company matching donation, employer matching donations 5 Requires at least: 6. 36 Tested up to: 6. 75 Requires at least: 6.6 6 Tested up to: 6.8 7 7 Requires PHP: 7.2 8 Stable tag: 2. 0.28 Stable tag: 2.1.0 9 9 Requires Give: 3.8.0 10 10 License: GPLv3 … … 17 17 Empower your GiveWP donors to have their company match their donations with the most powerful Company Matching platform: Double the Donation. 18 18 19 With this GiveWP add-on, simply add your Double the Donation API keys into the settings, then each of your forms can be enabled to accept company matching. 19 With this GiveWP add-on, simply add your Double the Donation API keys into the settings, then each of your forms can be enabled to accept company matching. 20 20 21 21 **ABOUT DOUBLE THE DONATION:** 22 Automate your matching gift fundraising with the industry-leading solution from Double the Donation. Double the Donation provides nonprofits with tools to identify match-eligible donors, drive matches to completion, and gain actionable insights. Our unique integration with GiveWP integrates directly into your donation forms, to capture employment information and follow up appropriately with donors about matching gifts. 22 Automate your matching gift fundraising with the industry-leading solution from Double the Donation. Double the Donation provides nonprofits with tools to identify match-eligible donors, drive matches to completion, and gain actionable insights. Our unique integration with GiveWP integrates directly into your donation forms, to capture employment information and follow up appropriately with donors about matching gifts. 23 23 24 24 **ABOUT OUR FREE ADD-ONS** … … 31 31 = Minimum Requirements = 32 32 33 * An active subscription to Double the Donation. 34 * WordPress 6. 3or greater33 * An active subscription to Double the Donation. 34 * WordPress 6.6 or greater 35 35 * PHP version 7.2 or greater 36 36 * MySQL version 5.7 or greater … … 58 58 The companies listed in the Double the Donation dropdown all registered with Double the Donation to provide their employees this opportunity. If your company does not appear there, then most likely they have not yet applied with Double the Donation. You can submit on their behalf, or [send them here to apply](https://doublethedonation.com/matching-gift-database/new-companies-with-matching-gift-programs/). 59 59 60 = I set my company to match, what happens next? = 60 = I set my company to match, what happens next? = 61 61 Your company will get an email and you will as well with next steps to follow. If you have any trouble with this process, contact [Double the Donation directly here](https://support.doublethedonation.com/portal/en/home). 62 62 63 == Screenshots == 63 == Screenshots == 64 64 65 1. The company search is powered by Double the Donation. It's fast and intuitive for your donors. 65 1. The company search is powered by Double the Donation. It's fast and intuitive for your donors. 66 66 67 67 2. Integrating Double the Donation with GiveWP is as simple as inserting your API keys in the settings fields. … … 70 70 71 71 == Changelog == 72 73 = 2.1.0: July 23rd, 2025 = 74 * New: Added compatibility with recurring donations 75 * New: Added additional company match field to the donation confirmation page 72 76 73 77 = 2.0.2: December 12th, 2024 = -
give-double-the-donation/trunk/src/DoubleTheDonation/AddonServiceProvider.php
r3207135 r3332990 3 3 namespace GiveDoubleTheDonation\DoubleTheDonation; 4 4 5 use Give\Donations\Models\Donation; 5 6 use Give\Helpers\Hooks; 6 7 use Give\ServiceProviders\ServiceProvider; … … 10 11 use GiveDoubleTheDonation\Addon\License; 11 12 use GiveDoubleTheDonation\DoubleTheDonation\Actions\CheckCredentials; 13 use GiveDoubleTheDonation\DoubleTheDonation\API\REST\CompanyMatching; 12 14 use GiveDoubleTheDonation\DoubleTheDonation\Helpers\SettingsPage as SettingsPageRegister; 13 15 … … 38 40 Hooks::addAction('give_donation_form_after_email', DonationForm::class, 'employerMatchField'); 39 41 40 // handle v2 forms stuff 41 if (isset($_POST) && ! isset($_POST['dtd'])) { 42 Hooks::addAction('give_insert_payment', Payment::class, 'addPaymentMeta', 10, 2); 43 Hooks::addAction('give_insert_payment', Payment::class, 'addDonationToDTD', 11, 2); 44 } 42 add_action('give_insert_payment', function($payment_id, $payment_data) { 43 // handle for v2 forms (v3 forms uses field scope) 44 if (isset($_POST) && !isset($_POST['dtd'])) { 45 give(Payment::class)->addPaymentMeta($payment_id, $payment_data); 46 47 $donation = Donation::find((int)$payment_id); 48 49 // handle for single donations only 50 if ($donation->type->isSingle()) { 51 give(Payment::class)->addDonationToDTD($payment_id, $payment_data); 52 } 53 } 54 }); 55 56 /** 57 * @since 2.1.0 add support for recurring donations 58 */ 59 Hooks::addAction('give_recurring_record_payment', Payment::class, 'addDonationToDTD', 10, 2); 45 60 46 61 // Show Receipt info … … 89 104 private function loadFrontend() 90 105 { 106 // @since 2.1.0 107 Hooks::addAction('rest_api_init', CompanyMatching::class); 108 91 109 // Load front-end assets. 92 110 Hooks::addAction('wp_enqueue_scripts', Assets::class, 'loadFrontendAssets'); 111 Hooks::addAction('givewp_donation_confirmation_receipt_showing', Assets::class, 'loadReceiptScripts'); 93 112 } 94 113 } -
give-double-the-donation/trunk/src/DoubleTheDonation/Assets.php
r3072620 r3332990 1 1 <?php 2 2 3 namespace GiveDoubleTheDonation\DoubleTheDonation; 3 4 … … 8 9 * @copyright Copyright (c) 2020, GiveWP 9 10 */ 10 class Assets { 11 class Assets 12 { 11 13 12 /** 13 * Load add-on backend assets. 14 * 15 * @since 1.0.0 16 * @return void 17 */ 18 public static function loadBackendAssets() { 14 /** 15 * Load add-on backend assets. 16 * 17 * @since 1.0.0 18 * @return void 19 */ 20 public static function loadBackendAssets() 21 { 19 22 $assets = require(GIVE_DTD_DIR . 'build/backend.asset.php'); 20 23 21 wp_enqueue_script(22 'give-double-the-donation-script-backend',24 wp_enqueue_script( 25 'give-double-the-donation-script-backend', 23 26 GIVE_DTD_URL . 'build/backend.js', 24 27 $assets['dependencies'], 25 28 $assets['version'], 26 true27 );28 }29 true 30 ); 31 } 29 32 30 /** 31 * Load add-on front-end assets. 32 * 33 * @since 1.0.0 34 * @return void 35 */ 36 public static function loadFrontendAssets() { 33 /** 34 * Load add-on front-end assets. 35 * 36 * @since 1.0.0 37 * @return void 38 */ 39 public static function loadFrontendAssets() 40 { 37 41 $assets = require(GIVE_DTD_DIR . 'build/frontend.asset.php'); 38 42 … … 40 44 41 45 wp_enqueue_script( 42 'give-double-the-donation-script',43 'https://doublethedonation.com/api/js/ddplugin.js',44 []45 );46 'give-double-the-donation-script', 47 'https://doublethedonation.com/api/js/ddplugin.js', 48 [] 49 ); 46 50 47 wp_enqueue_style(48 'give-double-the-donation-style',49 'https://doublethedonation.com/api/css/ddplugin.css',50 []51 );51 wp_enqueue_style( 52 'give-double-the-donation-style', 53 'https://doublethedonation.com/api/css/ddplugin.css', 54 [] 55 ); 52 56 53 57 wp_enqueue_script( … … 56 60 $assets['dependencies'], 57 61 $assets['version'], 58 true 59 ); 60 } 62 true 63 ); 64 } 65 66 /** 67 * @since 2.1.0 68 */ 69 public function loadReceiptScripts() 70 { 71 if ($dtdPublicKey = give_get_option('public_dtd_key')) { 72 $this->loadFrontendAssets(); 73 74 wp_register_script('givewp-dtd-receipt-script', null); 75 wp_add_inline_script( 76 'givewp-dtd-receipt-script', 77 sprintf("var DDCONF = {'API_KEY': '%s', 'GIVE_ENDPOINT': '%s'}", $dtdPublicKey, rest_url('givewp/dtd/donation/')), 78 'before' 79 ); 80 wp_enqueue_script('givewp-dtd-receipt-script', null, ['give-double-the-donation-script']); 81 } 82 } 61 83 } -
give-double-the-donation/trunk/src/DoubleTheDonation/FormExtension/Actions/ConvertBlockToField.php
r3207135 r3332990 3 3 namespace GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Actions; 4 4 5 use Give\Donations\Models\Donation;6 5 use Give\Framework\Blocks\BlockModel; 7 6 use Give\Framework\FieldsAPI\Contracts\Node; 8 7 use Give\Framework\FieldsAPI\Exceptions\EmptyNameException; 9 use GiveDoubleTheDonation\Addon\View;10 8 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Actions\FieldScope\HandleData; 11 9 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Field as DoubleTheDonationField; … … 30 28 ->showInReceipt() 31 29 ->receiptLabel(__('Company Matching', 'give-double-the-donation')) 32 ->receiptValue(function(DoubleTheDonationField $field, Donation $donation) {33 return View::load('dtd-receipt', [34 'donation' => $donation,35 ]);36 })37 30 ->tap(function (DoubleTheDonationField $field) use ($block) { 38 31 $field -
give-double-the-donation/trunk/src/DoubleTheDonation/FormExtension/Actions/FieldScope/HandleData.php
r3207135 r3332990 54 54 * Save payment meta 55 55 * 56 * @since 2.1.0 update visibility 56 57 * @since 2.0.0 57 58 */ 58 p rivatefunction save(array $companyData, Donation $donation)59 public function save(array $companyData, Donation $donation) 59 60 { 60 61 foreach ($companyData as $name => $value) { … … 82 83 * Send data to DTD 360match pro 83 84 * 85 * @since 2.1.0 update visibility 84 86 * @since 2.0.2 85 87 */ 86 p rivatefunction send(array $companyData, Donation $donation): void88 public function send(array $companyData, Donation $donation): void 87 89 { 88 90 if ( ! $dtdPublicKey = give_get_option('public_dtd_key')) { … … 132 134 ]); 133 135 } 136 137 /** 138 * Remove payment meta added on donation confirmation page 139 * 140 * @since 2.1.0 141 */ 142 public function remove(Donation $donation) 143 { 144 $fields = [ 145 'company_id', 146 'company_name', 147 'entered_text' 148 ]; 149 150 foreach ($fields as $name => $value) { 151 give_delete_meta( 152 $donation->id, 153 'doublethedonation_' . $name, 154 ); 155 } 156 157 give_delete_meta( 158 $donation->id, 159 '_give_donation_company', 160 ); 161 162 give()->donor_meta->delete_meta( 163 $donation->donorId, 164 '_give_donor_company', 165 ); 166 } 134 167 } -
give-double-the-donation/trunk/src/DoubleTheDonation/FormExtension/ServiceProvider.php
r3072620 r3332990 6 6 use Give\ServiceProviders\ServiceProvider as ServiceProviderInterface; 7 7 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Actions\ConvertBlockToField; 8 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Actions\DisplayField Label;8 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Actions\DisplayField; 9 9 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Actions\LoadAssets; 10 10 use GiveDoubleTheDonation\DoubleTheDonation\FormExtension\Email\EmailTags; … … 31 31 32 32 Hooks::addFilter('givewp_donation_form_block_render_givewp/dtd', ConvertBlockToField::class, '__invoke', 10, 4); 33 Hooks::addFilter('givewp_donation_confirmation_page_field_ label_for_dtd', DisplayFieldLabel::class, '__invoke', 10, 3);33 Hooks::addFilter('givewp_donation_confirmation_page_field_value_for_dtd', DisplayField::class, 'value', 10, 3); 34 34 35 35 Hooks::addFilter('give_email_tags', EmailTags::class, 'register'); -
give-double-the-donation/trunk/src/DoubleTheDonation/Payment.php
r3207135 r3332990 2 2 3 3 namespace GiveDoubleTheDonation\DoubleTheDonation; 4 5 use Give\Donations\Models\Donation; 4 6 5 7 class Payment { … … 52 54 */ 53 55 public function addDonationToDTD( $payment_id, $payment_data ) { 54 55 56 // API Key check 56 57 $dtdPublicKey = give_get_option( 'public_dtd_key', false ); -
give-double-the-donation/trunk/src/DoubleTheDonation/resources/js/frontend/give-double-the-donation.js
r2413638 r3332990 4 4 if ( ! input.hasAttribute( 'data-doublethedonation-widget-id' ) ) { 5 5 window.doublethedonation.plugin.load_streamlined_input( input ); 6 7 input.addEventListener('change', () => { 8 const donationId = input.dataset.donationId; 9 const receiptId = input.dataset.receiptId; 10 // do we have an event from DTD we can use?? 11 window.setTimeout(async () => { 12 const companyId = document.querySelector('[name="doublethedonation_company_id"]').value; 13 const companyName = document.querySelector('[name="doublethedonation_company_name"]').value; 14 const enteredText = document.querySelector('[name="doublethedonation_entered_text"]').value; 15 16 const response = await fetch(DDCONF.GIVE_ENDPOINT + donationId, { 17 method: 'POST', 18 headers: { 19 'Content-Type': 'application/json', 20 }, 21 body: JSON.stringify({ 22 companyId, 23 companyName, 24 enteredText, 25 receiptId 26 }), 27 }); 28 29 // select different company 30 document.querySelectorAll('.wrongcompany a')?.forEach((link) => { 31 link.addEventListener('click', () => { 32 const response = fetch(DDCONF.GIVE_ENDPOINT + donationId + `?receiptId=${receiptId}`, { 33 method: 'DELETE', 34 }); 35 }); 36 }); 37 }, 500) 38 }); 6 39 } 7 40 } ); … … 9 42 10 43 document.addEventListener( 'give_gateway_loaded', initializePlugin ); 11 12 initializePlugin(); 44 document.addEventListener('DOMContentLoaded', initializePlugin); 13 45 } -
give-double-the-donation/trunk/src/DoubleTheDonation/resources/views/dtd-receipt.php
r3207135 r3332990 6 6 /** 7 7 * @var Donation $donation 8 * @var string $receiptId 8 9 */ 9 10 … … 11 12 12 13 if ( ! $companyId) { 14 printf('<div class="dd-company-name-input" data-donation-id="%s" data-receipt-id="%s"></div>', $donation->id, $receiptId); 13 15 return; 14 16 } -
give-double-the-donation/trunk/vendor/autoload.php
r3072620 r3332990 15 15 } 16 16 } 17 trigger_error( 18 $err, 19 E_USER_ERROR 20 ); 17 throw new RuntimeException($err); 21 18 } 22 19 -
give-double-the-donation/trunk/vendor/composer/InstalledVersions.php
r3207135 r3332990 28 28 { 29 29 /** 30 * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to 31 * @internal 32 */ 33 private static $selfDir = null; 34 35 /** 30 36 * @var mixed[]|null 31 37 * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null 32 38 */ 33 39 private static $installed; 40 41 /** 42 * @var bool 43 */ 44 private static $installedIsLocalDir; 34 45 35 46 /** … … 310 321 self::$installed = $data; 311 322 self::$installedByVendor = array(); 323 324 // when using reload, we disable the duplicate protection to ensure that self::$installed data is 325 // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not, 326 // so we have to assume it does not, and that may result in duplicate data being returned when listing 327 // all installed packages for example 328 self::$installedIsLocalDir = false; 329 } 330 331 /** 332 * @return string 333 */ 334 private static function getSelfDir() 335 { 336 if (self::$selfDir === null) { 337 self::$selfDir = strtr(__DIR__, '\\', '/'); 338 } 339 340 return self::$selfDir; 312 341 } 313 342 … … 326 355 327 356 if (self::$canGetVendors) { 357 $selfDir = self::getSelfDir(); 328 358 foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { 359 $vendorDir = strtr($vendorDir, '\\', '/'); 329 360 if (isset(self::$installedByVendor[$vendorDir])) { 330 361 $installed[] = self::$installedByVendor[$vendorDir]; … … 334 365 self::$installedByVendor[$vendorDir] = $required; 335 366 $installed[] = $required; 336 if (s trtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {367 if (self::$installed === null && $vendorDir.'/composer' === $selfDir) { 337 368 self::$installed = $required; 338 $copiedLocalDir = true;369 self::$installedIsLocalDir = true; 339 370 } 371 } 372 if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) { 373 $copiedLocalDir = true; 340 374 } 341 375 }
Note: See TracChangeset
for help on using the changeset viewer.