Plugin Directory

Changeset 2702587


Ignore:
Timestamp:
03/31/2022 09:35:14 AM (4 years ago)
Author:
alexx123939
Message:

update widget to verision 1.0.2

Location:
crypto-voucher-widget
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • crypto-voucher-widget/trunk/cv_widget_image.php

    r2632302 r2702587  
    4141              src='".esc_attr(plugin_dir_url( __FILE__ )."images/buy_cv.svg")."'
    4242              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'])."'
    4745              })\"
    4846              class='cv-widget-image-button'
  • crypto-voucher-widget/trunk/readme.txt

    r2657646 r2702587  
    66Tested up to: 5.8.2
    77Requires PHP: 7.0.1
    8 Stable tag: 1.0.3
     8Stable tag: 2.0.0
    99License: GPLv2
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4141
    4242== Changelog ==
     43= 2.0.0 =
     44* Implementation of widget v2.0
     45
    4346= 1.1.0 =
    4447* Security improved: now widget uses iframe, so it has no influence on your website
     
    5962
    6063== Upgrade Notice ==
     64= 2.0.0 =
     65* Upgrade required, old versions no longer supported
    6166= 1.1.0 =
    6267* Significant update, update to the latest version recommended
  • crypto-voucher-widget/trunk/wp-plugin.php

    r2657646 r2702587  
    44Plugin URI:   https://www.npmjs.com/package/@crypto-voucher/widget
    55Description:  A simple hassle-free tool for selling cryptocurrency straight from your website.
    6 Version:      1.0.3
     6Version:      2.0.0
    77Author:       Crypto Voucher Team
    88Author URI:   https://cryptovoucher.io/
     
    1010
    1111require('cv_widget_image.php');
    12 require('cv_widget_text_button.php');
     12// require('cv_widget_text_button.php');
     13
    1314
    1415/* settings section */
     
    3940    add_settings_section( 'api_settings', 'API Settings', 'cv_widget_plugin_section_text', 'cv_widget_plugin' );
    4041
    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' );
    4443}
    4544add_action( 'admin_init', 'cv_widget_plugin_register_settings' );
     
    5049        $newinput['widget_token'] = '';
    5150    }
    52     if ( ! preg_match('/^#(?:[0-9a-fA-F]{3,4}){1,2}$/i', $newinput['base_color'] ) ) {
    53         $newinput['base_color'] = '';
    54     }
    5551
    5652    return $newinput;
     
    5854
    5955function 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>';
    6157}
    6258
    6359function cv_widget_plugin_options_widget_token() {
    6460    $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'] ) . "' />";
    7662}
    7763
     
    8066function cvvchwgt_register_widgets() {
    8167    register_widget( 'CV_Widget_Image' );
    82     register_widget( 'CV_Widget_Text_Button' );
    8368}
    8469add_action('widgets_init', 'cvvchwgt_register_widgets');
    8570
    8671
     72function 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}
     76add_action('wp_enqueue_scripts', 'cvvchwgt_load_scripts');
     77
     78function cvvchwgt_load_styles() {
     79  wp_enqueue_style('widget_styles', plugins_url('/plugins/cryptoVoucherWidget/style.css', __FILE__));
     80}
     81add_action('wp_enqueue_scripts', 'cvvchwgt_load_styles');
     82
     83
    8784function cvvchwgt_wpb_hook_javascript() {
    8885    ?>
    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';
    9189
    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          }
    93103        </script>
    94104    <?php
     
    99109function cvvchwgt_custom_content_after_body_open_tag() {
    100110    ?>
    101       <crypto-voucher-widget id='widget' ref='widget' class='cv-widget-plugin-er2eRRt34'></crypto-voucher-widget>
     111      <div id="widget_embed_sdfgSDFgs45gGw"></div>
    102112    <?php
    103113}
    104 
    105114add_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     <?php
    118 }
    119 add_action('wp_footer', 'cvvchwgt_wpb_hook_javascript_footer');
    120115?>
Note: See TracChangeset for help on using the changeset viewer.