Plugin Directory

Changeset 3328118


Ignore:
Timestamp:
07/15/2025 10:35:01 AM (6 months ago)
Author:
payuplugin
Message:

added version in udf5

Location:
payu-india
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • payu-india/tags/3.8.8/includes/class-wc-gateway-payu.php

    r3321893 r3328118  
    368368        $country = $order->billing_country ? sanitize_email($order->billing_country) : '';
    369369        $pG = '';
    370         $udf5 = 'WooCommerce';
     370        // Include a all plugins file through includes
     371        require_once ABSPATH . 'wp-admin/includes/plugin.php';
     372        if (! function_exists('is_plugin_active')) {
     373            require_once ABSPATH . 'wp-admin/includes/plugin.php';
     374        }
     375
     376        // Set default values
     377        $plugin_version = '3.8.8';
     378        $folder_name    = 'payu-india';
     379        $max_version    = '0.0.0';
     380
     381        // Loop through all installed plugins
     382        foreach (get_plugins() as $file => $data) {
     383            if (stripos($data['Name'], 'PayU') !== false) {
     384
     385                // If plugin is active OR has higher version than current max
     386                if (is_plugin_active($file) || version_compare($data['Version'], $max_version, '>')) {
     387                    $plugin_version = $data['Version'];
     388                    $folder_name    = dirname($file);
     389                    $max_version    = $data['Version'];
     390                }
     391            }
     392        }
     393
     394        // Build UDF5 string
     395        $udf5 = 'WooCommerce_version_' . $plugin_version;
     396        // $udf5 = 'WooCommerce';
    371397        $hash = $this->generateHashToken($txnid, $amount, $productInfo, $firstname, $email, $udf4, $udf5);
    372398
  • payu-india/trunk/includes/class-wc-gateway-payu.php

    r3321888 r3328118  
    368368        $country = $order->billing_country ? sanitize_email($order->billing_country) : '';
    369369        $pG = '';
    370         $udf5 = 'WooCommerce';
     370        // Include a all plugins file through includes
     371        require_once ABSPATH . 'wp-admin/includes/plugin.php';
     372        if (! function_exists('is_plugin_active')) {
     373            require_once ABSPATH . 'wp-admin/includes/plugin.php';
     374        }
     375
     376        // Set default values
     377        $plugin_version = '3.8.8';
     378        $folder_name    = 'payu-india';
     379        $max_version    = '0.0.0';
     380
     381        // Loop through all installed plugins
     382        foreach (get_plugins() as $file => $data) {
     383            if (stripos($data['Name'], 'PayU') !== false) {
     384
     385                // If plugin is active OR has higher version than current max
     386                if (is_plugin_active($file) || version_compare($data['Version'], $max_version, '>')) {
     387                    $plugin_version = $data['Version'];
     388                    $folder_name    = dirname($file);
     389                    $max_version    = $data['Version'];
     390                }
     391            }
     392        }
     393
     394        // Build UDF5 string
     395        $udf5 = 'WooCommerce_version_' . $plugin_version;
     396        // $udf5 = 'WooCommerce';
    371397        $hash = $this->generateHashToken($txnid, $amount, $productInfo, $firstname, $email, $udf4, $udf5);
    372398
Note: See TracChangeset for help on using the changeset viewer.