Skip to content

Commit

Permalink
Update tcom-payway-woocommerce.php
Browse files Browse the repository at this point in the history
  • Loading branch information
9jaDevo authored Dec 2, 2024
1 parent 3896443 commit 2c58cf8
Showing 1 changed file with 21 additions and 35 deletions.
56 changes: 21 additions & 35 deletions tcom-payway-woocommerce.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php
/*
* Plugin Name: PayWay Hrvatski Telekom payment gateway for Woocommerce
* Plugin Name: PayWay Hrvatski Telekom payment gateway for WooCommerce
* Plugin URI: https://github.com/marinsagovac/woocommerce-tcom-payway
* Description: PayWay Hrvatski Telekom payment gateway for Woocommerce
* Description: PayWay Hrvatski Telekom payment gateway for WooCommerce
* Version: 1.8.6
* @license: MIT
* License URI: https://opensource.org/licenses/MIT
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Author: Marin Šagovac
* Developers: Marin Šagovac, Matija Kovačević, Danijel Gubić, Ivan Švaljek, Micemade, 9jaDevo, Danijel-kt, nine-2-five, Chidiebere Chukwudi
* Text Domain: tcom-payway-wc
* Text Domain: woocommerce-tcom-payway
* Domain Path: /languages
*/

if (! defined('ABSPATH')) {
Expand All @@ -25,43 +26,34 @@
define('TCOM_PAYWAY_URL', plugin_dir_url(__FILE__));
}

// Remove or comment out the direct call to load_plugin_textdomain
// load_plugin_textdomain( 'tcom-payway-wc', false, trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );

/**
* Load plugin textdomain.
*/
function tcom_payway_load_textdomain()
{
load_plugin_textdomain(
'tcom-payway-wc', // Textdomain
false, // Deprecated argument, set to false
dirname(plugin_basename(__FILE__)) . '/languages/' // Path to language files
);
load_plugin_textdomain('woocommerce-tcom-payway', false, dirname(plugin_basename(__FILE__)) . '/languages');
}

add_action('init', 'tcom_payway_load_textdomain');

add_action('plugins_loaded', 'woocommerce_tpayway_gateway', 0);
function woocommerce_tpayway_gateway()
{

if (! class_exists('WC_Payment_Gateway')) {
if (!class_exists('WC_Payment_Gateway')) {
return;
}

require_once TCOM_PAYWAY_DIR . 'classes/class-wc-tpayway.php';

$wc = new WC_TPAYWAY();

function woocommerce_add_tpayway_gateway($methods)
{
$methods[] = 'WC_TPAYWAY';
return $methods;
}

add_filter('woocommerce_payment_gateways', 'woocommerce_add_tpayway_gateway');
}


global $jal_db_version;
$jal_db_version = '0.1';

Expand All @@ -70,26 +62,18 @@ function jal_install_tpayway()
global $wpdb;
global $jal_db_version;

$table_name = $wpdb->prefix . 'tpayway_ipg';
$charset_collate = '';

if (! empty($wpdb->charset)) {
$charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
}

if (! empty($wpdb->collate)) {
$charset_collate .= " COLLATE {$wpdb->collate}";
}
$table_name = $wpdb->prefix . 'tpayway_ipg';
$charset_collate = $wpdb->get_charset_collate(); // Ensure proper charset

$sql = "CREATE TABLE IF NOT EXISTS $table_name (
id int(9) NOT NULL AUTO_INCREMENT,
transaction_id int(9) NOT NULL,
response_code int(6) NOT NULL,
id INT(9) NOT NULL AUTO_INCREMENT,
transaction_id INT(9) NOT NULL,
response_code INT(6) NOT NULL,
response_code_desc VARCHAR(20) NOT NULL,
reason_code VARCHAR(20) NOT NULL,
amount VARCHAR(20) NOT NULL,
or_date DATE NOT NULL,
status int(6) NOT NULL,
status INT(6) NOT NULL,
UNIQUE KEY id (id)
) $charset_collate;";

Expand All @@ -98,25 +82,27 @@ function jal_install_tpayway()

add_option('jal_db_version', $jal_db_version);
}

register_activation_hook(__FILE__, 'jal_install_tpayway');

function jal_install_data_tpayway()
{
global $wpdb;

// Setup initial data for your table if necessary
$table_name = $wpdb->prefix . 'tpayway_ipg';
$welcome_name = 'PayWay Hrvatski Telekom';
$welcome_text = 'Congratulations, you just completed the installation!';

$table_name = $wpdb->prefix . 'tpayway_ipg';
}
register_activation_hook(__FILE__, 'jal_install_data_tpayway');


add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'jal_add_plugin_page_settings_link');
function jal_add_plugin_page_settings_link($links)
{
$links[] = '<a href="' .
admin_url('admin.php?page=wc-settings&tab=checkout&section=wc_tpayway') .
'">' . __('Settings', 'tcom-payway-wc') . '</a>';
'">' . __('Settings', 'woocommerce-tcom-payway') . '</a>';
return $links;
}

Expand Down

0 comments on commit 2c58cf8

Please sign in to comment.