Changeset 2702587
- Timestamp:
- 03/31/2022 09:35:14 AM (4 years ago)
- Location:
- crypto-voucher-widget
- Files:
-
- 5 edited
-
assets/screenshot.png (modified) (previous)
-
trunk/assets/screenshot.png (modified) (previous)
-
trunk/cv_widget_image.php (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/wp-plugin.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
crypto-voucher-widget/trunk/cv_widget_image.php
r2632302 r2702587 41 41 src='".esc_attr(plugin_dir_url( __FILE__ )."images/buy_cv.svg")."' 42 42 alt='Buy Cryptocurrency Directly' 43 onclick=\"startTransaction({ 44 referenceId: '".esc_attr($options['widget_token'])."', 45 primaryColor: '".esc_attr($options['base_color'])."', 46 logo: '".esc_attr($options['logo_url'])."' 43 onclick=\"window.startTransaction_hertlkj345h34({ 44 token: '".esc_attr($options['widget_token'])."' 47 45 })\" 48 46 class='cv-widget-image-button' -
crypto-voucher-widget/trunk/readme.txt
r2657646 r2702587 6 6 Tested up to: 5.8.2 7 7 Requires PHP: 7.0.1 8 Stable tag: 1.0.38 Stable tag: 2.0.0 9 9 License: GPLv2 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 41 41 42 42 == Changelog == 43 = 2.0.0 = 44 * Implementation of widget v2.0 45 43 46 = 1.1.0 = 44 47 * Security improved: now widget uses iframe, so it has no influence on your website … … 59 62 60 63 == Upgrade Notice == 64 = 2.0.0 = 65 * Upgrade required, old versions no longer supported 61 66 = 1.1.0 = 62 67 * Significant update, update to the latest version recommended -
crypto-voucher-widget/trunk/wp-plugin.php
r2657646 r2702587 4 4 Plugin URI: https://www.npmjs.com/package/@crypto-voucher/widget 5 5 Description: A simple hassle-free tool for selling cryptocurrency straight from your website. 6 Version: 1.0.36 Version: 2.0.0 7 7 Author: Crypto Voucher Team 8 8 Author URI: https://cryptovoucher.io/ … … 10 10 11 11 require('cv_widget_image.php'); 12 require('cv_widget_text_button.php'); 12 // require('cv_widget_text_button.php'); 13 13 14 14 15 /* settings section */ … … 39 40 add_settings_section( 'api_settings', 'API Settings', 'cv_widget_plugin_section_text', 'cv_widget_plugin' ); 40 41 41 add_settings_field( 'cv_widget_plugin_options_widget_token', 'Widget TOKEN *required', 'cv_widget_plugin_options_widget_token', 'cv_widget_plugin', 'api_settings' ); 42 add_settings_field( 'cv_widget_plugin_options_base_color', 'Base color', 'cv_widget_plugin_options_base_color', 'cv_widget_plugin', 'api_settings' ); 43 add_settings_field( 'cv_widget_plugin_options_logo_url', 'Logo URL', 'cv_widget_plugin_options_logo_url', 'cv_widget_plugin', 'api_settings' ); 42 add_settings_field( 'cv_widget_plugin_options_widget_token', 'API Token', 'cv_widget_plugin_options_widget_token', 'cv_widget_plugin', 'api_settings' ); 44 43 } 45 44 add_action( 'admin_init', 'cv_widget_plugin_register_settings' ); … … 50 49 $newinput['widget_token'] = ''; 51 50 } 52 if ( ! preg_match('/^#(?:[0-9a-fA-F]{3,4}){1,2}$/i', $newinput['base_color'] ) ) {53 $newinput['base_color'] = '';54 }55 51 56 52 return $newinput; … … 58 54 59 55 function cv_widget_plugin_section_text() { 60 echo '<p>Here you can set basic widget plugin options</p>';56 echo '<p>Here you can set your API token</p>'; 61 57 } 62 58 63 59 function cv_widget_plugin_options_widget_token() { 64 60 $options = get_option( 'cv_widget_plugin_options' ); 65 echo "<input id='cv_widget_plugin_options_widget_token' placeholder='widget token here...' name='cv_widget_plugin_options[widget_token]' type='text' value='" . esc_attr( $options['widget_token'] ) . "' />"; 66 } 67 68 function cv_widget_plugin_options_base_color() { 69 $options = get_option( 'cv_widget_plugin_options' ); 70 echo "<input id='cv_widget_plugin_options_base_color' placeholder='eg. #425DG332' name='cv_widget_plugin_options[base_color]' type='text' value='" . esc_attr( $options['base_color'] ) . "' />"; 71 } 72 73 function cv_widget_plugin_options_logo_url() { 74 $options = get_option( 'cv_widget_plugin_options' ); 75 echo "<input id='cv_widget_plugin_options_logo_url' name='cv_widget_plugin_options[logo_url]' type='text' value='" . esc_attr( $options['logo_url'] ) . "' />"; 61 echo "<input id='cv_widget_plugin_options_widget_token' placeholder='API token here...' name='cv_widget_plugin_options[widget_token]' type='text' value='" . esc_attr( $options['widget_token'] ) . "' />"; 76 62 } 77 63 … … 80 66 function cvvchwgt_register_widgets() { 81 67 register_widget( 'CV_Widget_Image' ); 82 register_widget( 'CV_Widget_Text_Button' );83 68 } 84 69 add_action('widgets_init', 'cvvchwgt_register_widgets'); 85 70 86 71 72 function cvvchwgt_load_scripts() { 73 wp_register_script('crypto_voucher_widget', plugins_url('/plugins/cryptoVoucherWidget/crypto-voucher-widget.umd.js', __FILE__), array(), '1.0', false); 74 wp_enqueue_script('crypto_voucher_widget'); 75 } 76 add_action('wp_enqueue_scripts', 'cvvchwgt_load_scripts'); 77 78 function cvvchwgt_load_styles() { 79 wp_enqueue_style('widget_styles', plugins_url('/plugins/cryptoVoucherWidget/style.css', __FILE__)); 80 } 81 add_action('wp_enqueue_scripts', 'cvvchwgt_load_styles'); 82 83 87 84 function cvvchwgt_wpb_hook_javascript() { 88 85 ?> 89 <script type="module"> 90 import { defineCustomElements } from 'https://cdn.jsdelivr.net/npm/@crypto-voucher/widget@latest/loader/index.es2017.js'; 86 <script> 87 window.onload = () => { 88 const baseUrl = 'https://widget-front.cryptovoucher.io'; 91 89 92 defineCustomElements(); 90 window.startTransaction_hertlkj345h34 = ({ token, amount = null, currency = null, extId = null }) => { 91 const widget = new CryptoVoucherWidget({ 92 selector: '#widget_embed_sdfgSDFgs45gGw', 93 token: token, 94 baseUrl: baseUrl, 95 amount, 96 currency, 97 extId 98 }); 99 100 widget.start(); 101 } 102 } 93 103 </script> 94 104 <?php … … 99 109 function cvvchwgt_custom_content_after_body_open_tag() { 100 110 ?> 101 < crypto-voucher-widget id='widget' ref='widget' class='cv-widget-plugin-er2eRRt34'></crypto-voucher-widget>111 <div id="widget_embed_sdfgSDFgs45gGw"></div> 102 112 <?php 103 113 } 104 105 114 add_action('wp_body_open', 'cvvchwgt_custom_content_after_body_open_tag'); 106 107 108 function cvvchwgt_wpb_hook_javascript_footer() {109 ?>110 <script>111 function startTransaction({ referenceId, primaryColor, logo }) {112 const widget = document.querySelector('#widget')113 114 widget.beginTransaction({ referenceId, primaryColor, logo })115 }116 </script>117 <?php118 }119 add_action('wp_footer', 'cvvchwgt_wpb_hook_javascript_footer');120 115 ?>
Note: See TracChangeset
for help on using the changeset viewer.