Changeset 2662719
- Timestamp:
- 01/24/2022 02:52:14 AM (4 years ago)
- Location:
- customdonations/tags/1.2
- Files:
-
- 5 edited
- 1 copied
-
. (copied) (copied from customdonations/trunk)
-
classes/cd-config-class.php (modified) (3 diffs)
-
classes/cd-shortcode-class.php (modified) (6 diffs)
-
customdonations.php (modified) (1 diff)
-
js/cd-shortcode.js (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
customdonations/tags/1.2/classes/cd-config-class.php
r2048717 r2662719 24 24 add_settings_section('customdonations_section_account', __('Optional Settings', 'customdonations'), null, 'customdonations'); 25 25 add_settings_field('customdonations_acctid', __('Account', 'customdonations'), [$this, 'customdonations_field_account_callback'], 'customdonations', 'customdonations_section_account', ['label_for' => 'customdonations_acctid', 'class' => 'customdonations_account_row', 'customdonations_custom_data' => 'custom']); 26 add_settings_field('customdonations_paymentver', __('Default Payment Version', 'customdonations'), [$this, 'customdonations_paymentver_callback'],'customdonations','customdonations_section_account', ['label_for' => 'customdonations_paymentver', 'class' => 'customdonations_account_row', 'customdonations_custom_data' => 'custom']);26 //add_settings_field('customdonations_paymentver', __('Default Payment Version', 'customdonations'), [$this, 'customdonations_paymentver_callback'],'customdonations','customdonations_section_account', ['label_for' => 'customdonations_paymentver', 'class' => 'customdonations_account_row', 'customdonations_custom_data' => 'custom']); 27 27 } 28 28 … … 111 111 * Allows the paymentVersion to have a different default, if the user wants to use inline forms across their site. 112 112 */ 113 function customdonations_paymentver_callback($args){113 /*function customdonations_paymentver_callback($args){ 114 114 ?> 115 115 <select id="<?php echo esc_attr($args['label_for']); ?>" name="customdonations_options[<?php echo esc_attr($args['label_for']); ?>]" … … 126 126 </p> 127 127 <?php 128 } 128 }*/ 129 129 130 130 /** -
customdonations/tags/1.2/classes/cd-shortcode-class.php
r2323399 r2662719 9 9 private $helper; 10 10 private $memberid_enabled, $memberid_field; //fields set in settings. 11 public $account, $form, $allocation, $mode, $memberId, $paymentVersion,$interval, $useReCaptcha, $shortcodeDebug;11 public $account, $form, $allocation, $mode, $memberId, /*$paymentVersion,*/ $interval, $useReCaptcha, $shortcodeDebug; 12 12 public $baseUrl = 'https://api.customdonations.com'; 13 13 public $apiVersion = 'v1'; … … 19 19 $opts = get_option('customdonations_options'); //get settings from the database 20 20 $config_acctid = !empty($opts['customdonations_acctid']) ? $opts['customdonations_acctid'] : null; //is there an account id configured in the DB? 21 $config_paymentver = !empty($opts['customdonations_paymentver']) && is_numeric($opts['customdonations_paymentver']) ? (int) $opts['customdonations_paymentver'] : 1;21 //$config_paymentver = !empty($opts['customdonations_paymentver']) && is_numeric($opts['customdonations_paymentver']) ? (int) $opts['customdonations_paymentver'] : 1; 22 22 $this->memberid_enabled = $helper::VarToBool($opts['customdonations_memberid_enabled']); 23 23 $this->memberid_field = !empty($opts['customdonations_memberid_field']) ? $opts['customdonations_memberid_field'] : null; //what field should be used for logged-in users? … … 27 27 $this->memberId = $this->memberid_enabled ? $this->fill_memberid_field() : null; //if we aren't wanting to fill memberId for logged-in users, use null as the value 28 28 $this->mode = ($mode === 'live' || $mode === 'test') ? esc_attr($mode) : null; //there is an issue if mode isn't provided. 29 $this->paymentVersion = !empty($paymentversion) && $paymentversion > 0 && $paymentversion <= 2 ? $paymentversion : $config_paymentver; //1: for modal payment window. 2: for inline payment with Google/Apple Pay options (US CLIENTS ONLY!)29 //$this->paymentVersion = !empty($paymentversion) && $paymentversion > 0 && $paymentversion <= 2 ? $paymentversion : $config_paymentver; //1: for modal payment window. 2: for inline payment with Google/Apple Pay options (US CLIENTS ONLY!) 30 30 $this->interval = $helper::VarToBool($interval) ? trim(strtolower($interval)) : null; // once, monthly, quarterly, yearly, or empty. 31 31 $this->useReCaptcha = $helper::VarToBool($userecaptcha); … … 75 75 function enqueue_customdonations_scripts_js() { 76 76 $dateTime = new DateTime(); 77 $frm_builder_script_url = "{$this->baseUrl}/{$this->apiVersion}/js/form-builder.min.js";77 //$frm_builder_script_url = "{$this->baseUrl}/{$this->apiVersion}/js/form-builder.min.js"; 78 78 $cacheBust = $dateTime->getTimestamp(); 79 wp_enqueue_script('customdonations-form-builder', $frm_builder_script_url, '', $cacheBust, true);79 //wp_enqueue_script('customdonations-form-builder', $frm_builder_script_url, '', $cacheBust, true); 80 80 wp_enqueue_script('customdonations-shortcode', plugins_url('../js/cd-shortcode.js', __FILE__), '', $cacheBust, true); 81 81 $data = [ … … 87 87 'baseUrl' => $this->baseUrl, 88 88 'mode' => $this->mode, 89 'paymentVersion' => $this->paymentVersion,89 //'paymentVersion' => $this->paymentVersion, 90 90 'interval' => $this->interval, 91 91 'useReCaptcha' => $this->useReCaptcha, … … 102 102 $user_current = wp_get_current_user(); 103 103 $return_val = null; //return null by default. 104 if ($this->memberid_field == "id") 105 $this->memberid_field = "ID"; 104 106 if (get_class($user_current) == "WP_User" && !empty($this->memberid_field)) { //we have a logged-in user. 105 107 $return_val = esc_attr($user_current->get($this->memberid_field)); //get the desired user field value. -
customdonations/tags/1.2/customdonations.php
r2313474 r2662719 6 6 * Author URI: https://www.customdonations.com 7 7 * Text Domain: customdonations 8 * Version: 1. 1.38 * Version: 1.2 9 9 * License: GPLv2 10 10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html -
customdonations/tags/1.2/js/cd-shortcode.js
r2313474 r2662719 1 class CustomDonations_WP{ 2 constructor(formData){ 3 this.debugEnabled = !!(formData.shortcodeDebug); 4 delete(formData.shortcodeDebug); 5 this.formData = formData; 6 this.formData.paymentVersion = parseInt(formData.paymentVersion); 7 this.formData.useReCaptcha = !!(formData.useReCaptcha); 8 } 9 Load(){ 10 this.debugEnabled ? console.log(this.formData) : null; 11 CustomDonations.BuildForm(this.formData); 12 } 13 } 14 var cdLoad = new CustomDonations_WP(shortcode_data); 15 cdLoad.Load(); 1 var cdDebugEnabled = !!(shortcode_data.shortcodeDebug); 2 delete(shortcode_data.shortcodeDebug); 3 var cdFormConfig = shortcode_data; 4 //cdFormConfig.paymentVersion = parseInt(shortcode_data.paymentVersion); 5 cdFormConfig.useReCaptcha = !!(shortcode_data.useReCaptcha); 6 7 var LoadCDScripts = function () { 8 var cdscript = document.createElement('script'); 9 cdscript.onerror = function (e) { 10 document.head.removeChild(this); 11 setTimeout(LoadCDScripts, 1750); 12 }; 13 cdscript.onload = function () { 14 cdDebugEnabled ? console.log(cdFormConfig) : null; 15 CustomDonations.BuildForm(cdFormConfig); 16 }; 17 cdscript.src = "https://api.customdonations.com/v1/js/form-builder.min.js?v=" + new Date().getTime(); 18 document.head.appendChild(cdscript); 19 }; 20 LoadCDScripts(); 16 21 shortcode_data = null; -
customdonations/tags/1.2/readme.txt
r2496435 r2662719 1 1 === CustomDonations.com === 2 Tested up to: 5. 72 Tested up to: 5.9 3 3 Requires PHP: 5.2 4 Stable tag: 1. 1.44 Stable tag: 1.2 5 5 License: GPLv2 6 6 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 34 34 To add a form to your site, add the following information from the Custom Donations site to your site in the following format: 35 35 36 `[CustomDonations account="account-id-goes-here" form="form-id-goes-here" mode="live" allocation="optional" paymentVersion=1]`36 `[CustomDonations account="account-id-goes-here" form="form-id-goes-here" mode="live" allocation="optional"]` 37 37 38 38 The value for allocation is optional and may be omitted from the shortcode if it doesn't apply to your form. The value for 'mode' if you wish to test your form is 'test'. … … 42 42 43 43 == Changelog == 44 = 1.2= 45 JavaScript improvements to shortcode loader. Minor bug fixes. 44 46 = 1.1.4 = 45 47 Adjustments to member id field processing.
Note: See TracChangeset
for help on using the changeset viewer.