Changeset 2710252
- Timestamp:
- 04/15/2022 02:59:06 PM (4 years ago)
- Location:
- transact
- Files:
-
- 10 edited
- 17 copied
-
tags/5.8.0 (copied) (copied from transact/trunk)
-
tags/5.8.0/README.md (copied) (copied from transact/trunk/README.md)
-
tags/5.8.0/admin/controllers/transact-admin-settings-menu.php (copied) (copied from transact/trunk/admin/controllers/transact-admin-settings-menu.php) (5 diffs)
-
tags/5.8.0/admin/controllers/transact-admin-settings-post.php (copied) (copied from transact/trunk/admin/controllers/transact-admin-settings-post.php) (3 diffs)
-
tags/5.8.0/admin/controllers/transact-api.php (modified) (1 diff)
-
tags/5.8.0/admin/controllers/transact-shortcode.php (copied) (copied from transact/trunk/admin/controllers/transact-shortcode.php)
-
tags/5.8.0/config.ini (copied) (copied from transact/trunk/config.ini)
-
tags/5.8.0/frontend/assets/style.css (copied) (copied from transact/trunk/frontend/assets/style.css) (1 diff)
-
tags/5.8.0/frontend/assets/transact_post.js (copied) (copied from transact/trunk/frontend/assets/transact_post.js) (1 diff)
-
tags/5.8.0/frontend/controllers/account_meta.php (copied) (copied from transact/trunk/frontend/controllers/account_meta.php)
-
tags/5.8.0/frontend/controllers/transact-api.php (copied) (copied from transact/trunk/frontend/controllers/transact-api.php) (3 diffs)
-
tags/5.8.0/frontend/controllers/transact-handle-buttons-shortcode.php (copied) (copied from transact/trunk/frontend/controllers/transact-handle-buttons-shortcode.php)
-
tags/5.8.0/frontend/controllers/transact-handle-buttons.php (copied) (copied from transact/trunk/frontend/controllers/transact-handle-buttons.php) (2 diffs)
-
tags/5.8.0/frontend/controllers/transact-single-post.php (copied) (copied from transact/trunk/frontend/controllers/transact-single-post.php)
-
tags/5.8.0/models/transact-button-types.php (copied) (copied from transact/trunk/models/transact-button-types.php)
-
tags/5.8.0/readme.txt (copied) (copied from transact/trunk/readme.txt) (2 diffs)
-
tags/5.8.0/transact-plugin.php (copied) (copied from transact/trunk/transact-plugin.php) (1 diff)
-
tags/5.8.0/utils/transact-utils-config-parser.php (copied) (copied from transact/trunk/utils/transact-utils-config-parser.php)
-
trunk/admin/controllers/transact-admin-settings-menu.php (modified) (5 diffs)
-
trunk/admin/controllers/transact-admin-settings-post.php (modified) (3 diffs)
-
trunk/admin/controllers/transact-api.php (modified) (1 diff)
-
trunk/frontend/assets/style.css (modified) (1 diff)
-
trunk/frontend/assets/transact_post.js (modified) (1 diff)
-
trunk/frontend/controllers/transact-api.php (modified) (3 diffs)
-
trunk/frontend/controllers/transact-handle-buttons.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/transact-plugin.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
transact/tags/5.8.0/admin/controllers/transact-admin-settings-menu.php
r2592925 r2710252 7 7 use Transact\Admin\Api\TransactApi; 8 8 require_once plugin_dir_path(__FILE__) . '/transact-api.php'; 9 10 use Transact\Utils\Settings\CurrencyUtils; 11 require_once plugin_dir_path(__FILE__) . '../../utils/transact-currency-utils.php'; 9 12 10 13 … … 114 117 115 118 /* 119 * Button Styles Manager 120 */ 121 add_settings_section( 122 'transact_general', // ID 123 'General Settings', // Title 124 function() { esc_html_e('','transact'); }, 125 'transact-settings' 126 ); 127 128 // Adding Currency key field 129 add_settings_field( 130 'transact_currency', 131 'Primary Currency', 132 array( $this, 'display_currency_callback' ), 133 'transact-settings', 134 'transact_general', 135 array( 136 'id' => 'transact_currency', 137 'default_val' => 'PROD') // Default value 138 ); 139 140 add_settings_field( 141 'display_cents_dollars', 142 'Price Display Format', 143 array( $this, 'display_cents_dollars_callback' ), 144 'transact-settings', 145 'transact_general', 146 array( 147 'id' => 'transact_purchase_button_text', 148 'default_val' => 'cents') // Default value 149 ); 150 151 add_settings_field( 152 'transact_search_engine_access', 153 'Search Engine Access', 154 array( $this, 'display_search_engine_callback' ), 155 'transact-settings', 156 'transact_general', 157 array( 158 'id' => 'transact_search_engine_access', 159 'default_val' => 'seo_no_access') // Default value 160 ); 161 162 163 164 add_settings_field( 165 'default_purchase_type', 166 'Default Post Purchase Type', 167 array( $this, 'default_purchase_type_callback' ), 168 'transact-settings', 169 'transact_general', 170 array( 171 'id' => 'transact_default_purchase_type', 172 'default_val' => 'subscribe_purchase') // Default value 173 ); 174 175 /* 116 176 * Post Types Manager 117 177 */ … … 232 292 'xct_button_style', 233 293 array(false) // Default value 234 );235 236 add_settings_field(237 'display_cents_dollars',238 'Price Display Format',239 array( $this, 'display_cents_dollars_callback' ),240 'transact-settings',241 'xct_button_style',242 array(243 'id' => 'transact_purchase_button_text',244 'default_val' => 'cents') // Default value245 );246 247 add_settings_field(248 'transact_search_engine_access',249 'Search Engine Access',250 array( $this, 'display_search_engine_callback' ),251 'transact-settings',252 'xct_button_style',253 array(254 'id' => 'transact_search_engine_access',255 'default_val' => 'seo_no_access') // Default value256 );257 258 259 260 add_settings_field(261 'default_purchase_type',262 'Default Post Purchase Type',263 array( $this, 'default_purchase_type_callback' ),264 'transact-settings',265 'xct_button_style',266 array(267 'id' => 'transact_default_purchase_type',268 'default_val' => 'subscribe_purchase') // Default value269 294 ); 270 295 … … 637 662 } 638 663 664 public function display_currency_callback($args) 665 { 666 $currency_options = array('PROD', 'GBP', 'EUR', 'JPY', 'CAD'); 667 $option_labels = array( 668 'PROD' => 'USD', 669 'GBP' => 'GBP', 670 'EUR' => 'EUR', 671 'JPY' => 'JPY', 672 'CAD' => 'CAD' 673 ); 674 $currency_utils = new CurrencyUtils(); 675 $selected_option = $currency_utils->get_currency_from_options(); 676 ?> 677 <script> 678 // Sets the real setting field 679 function setCurrencyValue(val) { 680 jQuery('#transact_currency').val(val); 681 } 682 </script> 683 <input 684 id="transact_currency" 685 type="hidden" 686 name="transact-settings[transact_currency]" 687 value="<?php echo esc_attr($selected_option); ?>" 688 /> 689 690 <?php 691 for($i = 0; $i < count($currency_options); $i++) { 692 $i_option = $currency_options[$i]; 693 $field_id = "transact_currency_" . $i_option; 694 $is_checked = $i_option === $selected_option ? 'checked' : ''; 695 696 ?> 697 <input <?php echo esc_attr($is_checked); ?> 698 id="<?php echo esc_html($field_id); ?>" 699 type="radio" 700 onclick="setCurrencyValue('<?php echo esc_attr($i_option); ?>')" 701 name="uf-transact_currency" 702 value="<?php echo esc_attr($i_option); ?>" 703 /> 704 <label for="<?php echo esc_html($field_id); ?>"><?php echo esc_html($option_labels[$i_option]); ?></label> 705 <br /> 706 <?php 707 } 708 } 709 639 710 public function default_purchase_type_callback($args) 640 711 { … … 714 785 $options = get_option('transact-settings'); 715 786 return $options['secret_key']; 716 }717 718 /**719 * Gets environment from Settings720 * @return string721 */722 public function get_env()723 {724 $options = get_option('transact-settings');725 return $options['environment'];726 787 } 727 788 -
transact/tags/5.8.0/admin/controllers/transact-admin-settings-post.php
r2685584 r2710252 9 9 10 10 require_once plugin_dir_path(__FILE__) . 'transact-shortcode.php'; 11 12 use Transact\Utils\Settings\CurrencyUtils; 13 require_once plugin_dir_path(__FILE__) . '../../utils/transact-currency-utils.php'; 11 14 12 15 … … 185 188 return; 186 189 } 190 191 $currency_utils = new CurrencyUtils(); 187 192 188 193 // Add an nonce field so we can check for it later. … … 499 504 <div id="transact_price_field" class="transact_meta_field"> 500 505 <span class="transact-price-input"> 506 <span class="currency_symbol"><?php echo esc_html($currency_utils->get_currency_symbol()); ?></span> 501 507 <input type="number" min="0.01" step="0.01" id="transact_price" class="transact-price-input__field" 502 508 onchange="check_transact_price()" -
transact/tags/5.8.0/admin/controllers/transact-api.php
r2420344 r2710252 43 43 $ret = wp_remote_get($url); 44 44 45 if (empty($ret) ) {45 if (empty($ret) || is_wp_error(($ret))) { 46 46 return false; 47 47 } -
transact/tags/5.8.0/frontend/assets/style.css
r2584433 r2710252 211 211 font-size: 15px; 212 212 } 213 .transact-price-input::before { 214 content: '$'; 213 .transact-price-input .currency_symbol { 215 214 position: absolute; 216 215 top: 50%; 217 216 left: 10px; 218 line-height: 0;217 line-height: 3px; 219 218 z-index: 10; 220 219 } -
transact/tags/5.8.0/frontend/assets/transact_post.js
r2685584 r2710252 58 58 59 59 if (promoBlock && promoBlock.length) { 60 promoBlock.css('color', transact_params.theme.background_color); 61 // this text comes from transact.io who we trust 62 // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html 63 promoBlock.html(result.text); 60 if (result) { 61 promoBlock.css('color', transact_params.theme.background_color); 62 // this text comes from transact.io who we trust 63 // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html 64 promoBlock.html(result.text); 65 } else { 66 promoBlock.css('display', 'none'); 67 } 64 68 } 65 69 }); -
transact/tags/5.8.0/frontend/controllers/transact-api.php
r2685584 r2710252 1 1 <?php 2 2 namespace Transact\FrontEnd\Controllers\Api; 3 4 use Transact\Utils\Settings\CurrencyUtils; 5 require_once plugin_dir_path(__FILE__) . '../../utils/transact-currency-utils.php'; 3 6 4 7 /** … … 89 92 function get_transact_information() 90 93 { 94 $currency_utils = new CurrencyUtils(); 91 95 $settings_menu_dashboard = new AdminSettingsMenuExtension(); 92 96 $this->recipient_id = $settings_menu_dashboard->get_account_id(); 93 97 $this->secret_id = $settings_menu_dashboard->get_secret(); 94 98 $this->get_search_engine_access = $settings_menu_dashboard->get_search_engine_access(); 95 $this->env = 'PROD'; // TEST or PROD99 $this->env = $currency_utils->get_currency_from_options(); // TEST, PROD, or another currency code 96 100 97 101 $settings_post = new AdminSettingsPostExtension($this->post_id); … … 238 242 } 239 243 240 // Required: Set PROD to use real money, TEST for testing244 // Required: Set PROD to use USD, TEST for testing money, or any currency code (USD/GBP) 241 245 $transact->setClass($this->env); 242 246 -
transact/tags/5.8.0/frontend/controllers/transact-handle-buttons.php
r2685584 r2710252 2 2 3 3 namespace Transact\FrontEnd\Controllers\Buttons; 4 5 use Transact\Utils\Settings\CurrencyUtils; 6 require_once plugin_dir_path(__FILE__) . '../../utils/transact-currency-utils.php'; 7 4 8 5 9 … … 405 409 $button_text = $this->options['transact_purchase_button_text'] . ' '. $price . ' ' . $token_text; 406 410 } else { 407 $button_text = $this->options['transact_purchase_button_text'] . ' $'. $price / 100; 411 $currency_util = new CurrencyUtils(); 412 413 $button_text = $this->options['transact_purchase_button_text'] . ' ' . $currency_util->localize_currency_from_options($price); 408 414 } 409 415 -
transact/tags/5.8.0/readme.txt
r2685584 r2710252 5 5 Requires at least: 5.0 6 6 Requires PHP: 5.6 7 Tested up to: 5.9. 18 Stable tag: 5. 7.07 Tested up to: 5.9.3 8 Stable tag: 5.8.0 9 9 License: APACHE-2.0 10 10 License URI: https://www.apache.org/licenses/LICENSE-2.0 … … 82 82 == Changelog == 83 83 84 = 5.8.0 = 85 * Primary currency selection for USD, GBP, EUR, CAD 86 84 87 = 5.7.0 = 85 88 * Add feature to login with transact. -
transact/tags/5.8.0/transact-plugin.php
r2685584 r2710252 3 3 * Plugin Name: transact.io 4 4 * Description: Integrates transact.io services into WP 5 * Version: 5. 7.05 * Version: 5.8.0 6 6 * Author: transact.io 7 7 * Author URI: https://transact.io 8 8 * Plugin URI: https://wordpress.org/plugins/transact/ 9 9 */ 10 define('TRANSACT_VERSION', '5. 7.0'); // Cache busting10 define('TRANSACT_VERSION', '5.8.0'); // Cache busting 11 11 12 12 /** -
transact/trunk/admin/controllers/transact-admin-settings-menu.php
r2592925 r2710252 7 7 use Transact\Admin\Api\TransactApi; 8 8 require_once plugin_dir_path(__FILE__) . '/transact-api.php'; 9 10 use Transact\Utils\Settings\CurrencyUtils; 11 require_once plugin_dir_path(__FILE__) . '../../utils/transact-currency-utils.php'; 9 12 10 13 … … 114 117 115 118 /* 119 * Button Styles Manager 120 */ 121 add_settings_section( 122 'transact_general', // ID 123 'General Settings', // Title 124 function() { esc_html_e('','transact'); }, 125 'transact-settings' 126 ); 127 128 // Adding Currency key field 129 add_settings_field( 130 'transact_currency', 131 'Primary Currency', 132 array( $this, 'display_currency_callback' ), 133 'transact-settings', 134 'transact_general', 135 array( 136 'id' => 'transact_currency', 137 'default_val' => 'PROD') // Default value 138 ); 139 140 add_settings_field( 141 'display_cents_dollars', 142 'Price Display Format', 143 array( $this, 'display_cents_dollars_callback' ), 144 'transact-settings', 145 'transact_general', 146 array( 147 'id' => 'transact_purchase_button_text', 148 'default_val' => 'cents') // Default value 149 ); 150 151 add_settings_field( 152 'transact_search_engine_access', 153 'Search Engine Access', 154 array( $this, 'display_search_engine_callback' ), 155 'transact-settings', 156 'transact_general', 157 array( 158 'id' => 'transact_search_engine_access', 159 'default_val' => 'seo_no_access') // Default value 160 ); 161 162 163 164 add_settings_field( 165 'default_purchase_type', 166 'Default Post Purchase Type', 167 array( $this, 'default_purchase_type_callback' ), 168 'transact-settings', 169 'transact_general', 170 array( 171 'id' => 'transact_default_purchase_type', 172 'default_val' => 'subscribe_purchase') // Default value 173 ); 174 175 /* 116 176 * Post Types Manager 117 177 */ … … 232 292 'xct_button_style', 233 293 array(false) // Default value 234 );235 236 add_settings_field(237 'display_cents_dollars',238 'Price Display Format',239 array( $this, 'display_cents_dollars_callback' ),240 'transact-settings',241 'xct_button_style',242 array(243 'id' => 'transact_purchase_button_text',244 'default_val' => 'cents') // Default value245 );246 247 add_settings_field(248 'transact_search_engine_access',249 'Search Engine Access',250 array( $this, 'display_search_engine_callback' ),251 'transact-settings',252 'xct_button_style',253 array(254 'id' => 'transact_search_engine_access',255 'default_val' => 'seo_no_access') // Default value256 );257 258 259 260 add_settings_field(261 'default_purchase_type',262 'Default Post Purchase Type',263 array( $this, 'default_purchase_type_callback' ),264 'transact-settings',265 'xct_button_style',266 array(267 'id' => 'transact_default_purchase_type',268 'default_val' => 'subscribe_purchase') // Default value269 294 ); 270 295 … … 637 662 } 638 663 664 public function display_currency_callback($args) 665 { 666 $currency_options = array('PROD', 'GBP', 'EUR', 'JPY', 'CAD'); 667 $option_labels = array( 668 'PROD' => 'USD', 669 'GBP' => 'GBP', 670 'EUR' => 'EUR', 671 'JPY' => 'JPY', 672 'CAD' => 'CAD' 673 ); 674 $currency_utils = new CurrencyUtils(); 675 $selected_option = $currency_utils->get_currency_from_options(); 676 ?> 677 <script> 678 // Sets the real setting field 679 function setCurrencyValue(val) { 680 jQuery('#transact_currency').val(val); 681 } 682 </script> 683 <input 684 id="transact_currency" 685 type="hidden" 686 name="transact-settings[transact_currency]" 687 value="<?php echo esc_attr($selected_option); ?>" 688 /> 689 690 <?php 691 for($i = 0; $i < count($currency_options); $i++) { 692 $i_option = $currency_options[$i]; 693 $field_id = "transact_currency_" . $i_option; 694 $is_checked = $i_option === $selected_option ? 'checked' : ''; 695 696 ?> 697 <input <?php echo esc_attr($is_checked); ?> 698 id="<?php echo esc_html($field_id); ?>" 699 type="radio" 700 onclick="setCurrencyValue('<?php echo esc_attr($i_option); ?>')" 701 name="uf-transact_currency" 702 value="<?php echo esc_attr($i_option); ?>" 703 /> 704 <label for="<?php echo esc_html($field_id); ?>"><?php echo esc_html($option_labels[$i_option]); ?></label> 705 <br /> 706 <?php 707 } 708 } 709 639 710 public function default_purchase_type_callback($args) 640 711 { … … 714 785 $options = get_option('transact-settings'); 715 786 return $options['secret_key']; 716 }717 718 /**719 * Gets environment from Settings720 * @return string721 */722 public function get_env()723 {724 $options = get_option('transact-settings');725 return $options['environment'];726 787 } 727 788 -
transact/trunk/admin/controllers/transact-admin-settings-post.php
r2685584 r2710252 9 9 10 10 require_once plugin_dir_path(__FILE__) . 'transact-shortcode.php'; 11 12 use Transact\Utils\Settings\CurrencyUtils; 13 require_once plugin_dir_path(__FILE__) . '../../utils/transact-currency-utils.php'; 11 14 12 15 … … 185 188 return; 186 189 } 190 191 $currency_utils = new CurrencyUtils(); 187 192 188 193 // Add an nonce field so we can check for it later. … … 499 504 <div id="transact_price_field" class="transact_meta_field"> 500 505 <span class="transact-price-input"> 506 <span class="currency_symbol"><?php echo esc_html($currency_utils->get_currency_symbol()); ?></span> 501 507 <input type="number" min="0.01" step="0.01" id="transact_price" class="transact-price-input__field" 502 508 onchange="check_transact_price()" -
transact/trunk/admin/controllers/transact-api.php
r2420344 r2710252 43 43 $ret = wp_remote_get($url); 44 44 45 if (empty($ret) ) {45 if (empty($ret) || is_wp_error(($ret))) { 46 46 return false; 47 47 } -
transact/trunk/frontend/assets/style.css
r2584433 r2710252 211 211 font-size: 15px; 212 212 } 213 .transact-price-input::before { 214 content: '$'; 213 .transact-price-input .currency_symbol { 215 214 position: absolute; 216 215 top: 50%; 217 216 left: 10px; 218 line-height: 0;217 line-height: 3px; 219 218 z-index: 10; 220 219 } -
transact/trunk/frontend/assets/transact_post.js
r2685584 r2710252 58 58 59 59 if (promoBlock && promoBlock.length) { 60 promoBlock.css('color', transact_params.theme.background_color); 61 // this text comes from transact.io who we trust 62 // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html 63 promoBlock.html(result.text); 60 if (result) { 61 promoBlock.css('color', transact_params.theme.background_color); 62 // this text comes from transact.io who we trust 63 // phpcs:ignore WordPressVIPMinimum.JS.HTMLExecutingFunctions.html 64 promoBlock.html(result.text); 65 } else { 66 promoBlock.css('display', 'none'); 67 } 64 68 } 65 69 }); -
transact/trunk/frontend/controllers/transact-api.php
r2685584 r2710252 1 1 <?php 2 2 namespace Transact\FrontEnd\Controllers\Api; 3 4 use Transact\Utils\Settings\CurrencyUtils; 5 require_once plugin_dir_path(__FILE__) . '../../utils/transact-currency-utils.php'; 3 6 4 7 /** … … 89 92 function get_transact_information() 90 93 { 94 $currency_utils = new CurrencyUtils(); 91 95 $settings_menu_dashboard = new AdminSettingsMenuExtension(); 92 96 $this->recipient_id = $settings_menu_dashboard->get_account_id(); 93 97 $this->secret_id = $settings_menu_dashboard->get_secret(); 94 98 $this->get_search_engine_access = $settings_menu_dashboard->get_search_engine_access(); 95 $this->env = 'PROD'; // TEST or PROD99 $this->env = $currency_utils->get_currency_from_options(); // TEST, PROD, or another currency code 96 100 97 101 $settings_post = new AdminSettingsPostExtension($this->post_id); … … 238 242 } 239 243 240 // Required: Set PROD to use real money, TEST for testing244 // Required: Set PROD to use USD, TEST for testing money, or any currency code (USD/GBP) 241 245 $transact->setClass($this->env); 242 246 -
transact/trunk/frontend/controllers/transact-handle-buttons.php
r2685584 r2710252 2 2 3 3 namespace Transact\FrontEnd\Controllers\Buttons; 4 5 use Transact\Utils\Settings\CurrencyUtils; 6 require_once plugin_dir_path(__FILE__) . '../../utils/transact-currency-utils.php'; 7 4 8 5 9 … … 405 409 $button_text = $this->options['transact_purchase_button_text'] . ' '. $price . ' ' . $token_text; 406 410 } else { 407 $button_text = $this->options['transact_purchase_button_text'] . ' $'. $price / 100; 411 $currency_util = new CurrencyUtils(); 412 413 $button_text = $this->options['transact_purchase_button_text'] . ' ' . $currency_util->localize_currency_from_options($price); 408 414 } 409 415 -
transact/trunk/readme.txt
r2685584 r2710252 5 5 Requires at least: 5.0 6 6 Requires PHP: 5.6 7 Tested up to: 5.9. 18 Stable tag: 5. 7.07 Tested up to: 5.9.3 8 Stable tag: 5.8.0 9 9 License: APACHE-2.0 10 10 License URI: https://www.apache.org/licenses/LICENSE-2.0 … … 82 82 == Changelog == 83 83 84 = 5.8.0 = 85 * Primary currency selection for USD, GBP, EUR, CAD 86 84 87 = 5.7.0 = 85 88 * Add feature to login with transact. -
transact/trunk/transact-plugin.php
r2685584 r2710252 3 3 * Plugin Name: transact.io 4 4 * Description: Integrates transact.io services into WP 5 * Version: 5. 7.05 * Version: 5.8.0 6 6 * Author: transact.io 7 7 * Author URI: https://transact.io 8 8 * Plugin URI: https://wordpress.org/plugins/transact/ 9 9 */ 10 define('TRANSACT_VERSION', '5. 7.0'); // Cache busting10 define('TRANSACT_VERSION', '5.8.0'); // Cache busting 11 11 12 12 /**
Note: See TracChangeset
for help on using the changeset viewer.