Plugin Directory

Changeset 2977311


Ignore:
Timestamp:
10/11/2023 06:03:24 AM (2 years ago)
Author:
blockonomics
Message:

Hotfix for page issues

Location:
blockonomics-bitcoin-payments/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • blockonomics-bitcoin-payments/trunk/blockonomics-woocommerce.php

    r2971235 r2977311  
    44 * Plugin URI: https://github.com/blockonomics/woocommerce-plugin
    55 * Description: Accept Bitcoin Payments on your WooCommerce-powered website with Blockonomics
    6  * Version: 3.6.5
     6 * Version: 3.6.6
    77 * Author: Blockonomics
    88 * Author URI: https://www.blockonomics.co
     
    6868    add_action('wp_enqueue_scripts', 'bnomics_register_stylesheets');
    6969    add_action('wp_enqueue_scripts', 'bnomics_register_scripts');
    70     add_filter( 'display_post_states', 'bnomics_add_display_post_states', 10, 2 );
    7170    add_filter("wp_list_pages_excludes", "bnomics_exclude_pages");
    72 
    73     function bnomics_add_display_post_states( $post_states, $post ) {
    74         if ( wc_get_page_id( 'payment' ) === $post->ID ) {
    75             $post_states['wc_page_for_payment'] = __( 'Blockonomics Payment Page', 'woocommerce' );
    76         }
    77 
    78         return $post_states;
    79     }
    8071
    8172    function bnomics_exclude_pages( $exclude ) {
     
    8576
    8677    function add_payment_page_shortcode() {
     78        // This is to make sure we only run the shortcode when executed to render the page.
     79        // Because the shortcode can be run multiple times by other plugin like All in One SEO.
     80        // Where it tries to build SEO content from the shortcode and this could lead to checkout page not loading correctly.
     81        $currentFilter = current_filter();
     82        if ($currentFilter != 'the_content') {
     83            return;
     84        }
     85       
    8786        $show_order = isset($_GET["show_order"]) ? sanitize_text_field(wp_unslash($_GET['show_order'])) : "";
    8887        $crypto = isset($_GET["crypto"]) ? sanitize_key($_GET['crypto']) : "";
     
    575574
    576575global $blockonomics_db_version;
    577 $blockonomics_db_version = '1.3';
     576$blockonomics_db_version = '1.4';
    578577
    579578function blockonomics_create_table() {
     
    620619function blockonomics_create_payment_page()
    621620{
     621    global $wp_rewrite;
     622
     623    if ( null === $wp_rewrite ) {
     624        $wp_rewrite = new \WP_Rewrite;
     625    }
    622626    wc_create_page(
    623627        'payment',
     
    650654        blockonomics_create_table();
    651655    }
    652     if (version_compare($installed_ver, '1.3', '<')){ // Plugin version should be 1.3
     656    if (version_compare($installed_ver, '1.4', '<')){ // Plugin version should be 1.4
    653657        include_once(WC()->plugin_path().'/includes/admin/wc-admin-functions.php');
    654658        blockonomics_create_payment_page();
  • blockonomics-bitcoin-payments/trunk/php/Blockonomics.php

    r2971235 r2977311  
    462462        // Load the checkout template
    463463        ob_start(); // Start buffering
    464         include plugin_dir_path(__FILE__)."../templates/" .$template;
     464        include_once plugin_dir_path(__FILE__)."../templates/" .$template;
    465465        return ob_get_clean(); // Return the buffered content
    466466    }
     
    608608                $context['crypto_rate_str'] = $this->get_crypto_rate_from_params($order['expected_fiat'], $order['expected_satoshi']);
    609609                //Using svg library qrcode.php to generate QR Code in NoJS mode
    610                 $context['qrcode_svg_element'] = $this->generate_qrcode_svg_element($context['payment_uri']);
     610                if($this->is_nojs_active()){
     611                    $context['qrcode_svg_element'] = $this->generate_qrcode_svg_element($context['payment_uri']);
     612                }
    611613
    612614                $context['total'] = $order['expected_fiat'];
     
    826828                $this->add_note_on_underpayment($order, $wc_order);
    827829                $this->send_email_on_underpayment($order);
    828                 $wc_order->save;
    829830            }
    830831            else {
     
    879880
    880881        $this->update_order($order);
     882
     883        $blockonomics_currencies = $this->getSupportedCurrencies();
     884        $selected_currency = $blockonomics_currencies[$order['crypto']];
     885        $wc_order->set_payment_method_title($selected_currency['name']);
     886        $wc_order->save();
    881887    }
    882888
     
    897903
    898904    public function generate_qrcode_svg_element($data) {
    899         include plugin_dir_path(__FILE__) . 'qrcode.php';
     905        include_once plugin_dir_path(__FILE__) . 'qrcode.php';
    900906        $codeText = sanitize_text_field($data);
    901907        return QRcode::svg($codeText);
  • blockonomics-bitcoin-payments/trunk/readme.txt

    r2971235 r2977311  
    44Requires at least: 3.0.1
    55Tested up to: 6.3.1
    6 Stable tag: 3.6.5
     6Stable tag: 3.6.6
    77License: MIT
    88License URI: http://opensource.org/licenses/MIT
     
    8484== Changelog ==
    8585
     86= 3.6.6  =
     87* Fix plugin conflict where shortcode executed multiple times
     88* Fix page creation sometimes failing on upgrade
     89
    8690= 3.6.5  =
    8791* Using a new internally created page as the payment page
Note: See TracChangeset for help on using the changeset viewer.