paystack/paystack.php
2025-01-19 12:18:55 +00:00

85 lines
2.3 KiB
PHP

<?php
defined('BASEPATH') or exit('No direct script access allowed');
/*
Module Name: Paystack Payment Gateway
Description: Payment gateway integration for processing payments through Paystack
Version: 1.0.0
Requires at least: 2.3.4
Author: [Your Name]
Author URI: [Your Website]
*/
define('PAYSTACK_MODULE_NAME', 'PAYSTACK');
/**
* Activation hook
*/
function paystack_activation_hook()
{
$CI = &get_instance();
require_once(__DIR__ . '/install.php');
}
/**
* Add menu items for Paystack
* @return null
*/
function paystack_init_menu_items()
{
$CI = &get_instance();
// Main Menu Item
if (has_permission('payments', '', 'view')) {
$CI->app_menu->add_sidebar_menu_item('paystack', [
'name' => 'Paystack',
'position' => 30,
'icon' => 'fa fa-credit-card',
]);
// Sub Menu Items
$CI->app_menu->add_sidebar_children_item('paystack', [
'slug' => 'paystack-dashboard',
'name' => _l('dashboard'),
'href' => admin_url('paystack/admin/dashboard'),
'position' => 1,
]);
$CI->app_menu->add_sidebar_children_item('paystack', [
'slug' => 'paystack-transactions',
'name' => _l('transactions'),
'href' => admin_url('paystack/admin/transactions'),
'position' => 5,
]);
}
// Settings Menu Item
if (has_permission('settings', '', 'view')) {
$CI->app_menu->add_setup_menu_item('paystack-settings', [
'name' => _l('paystack_settings'),
'href' => admin_url('paystack/admin/settings'),
'position' => 65,
'icon' => 'fa fa-credit-card',
]);
$CI->app_menu->add_setup_menu_item('paystack-test-mode', [
'parent' => 'paystack-settings',
'name' => _l('test_mode'),
'href' => admin_url('paystack/admin/test_mode'),
'position' => 5,
]);
}
}
// Register activation hook
register_activation_hook('paystack', 'paystack_activation_hook');
// Register payment gateway
register_payment_gateway('paystack_gateway', 'paystack');
// Add menu items
hooks()->add_action('admin_init', 'paystack_init_menu_items');
register_language_files(PAYSTACK_MODULE_NAME, [PAYSTACK_MODULE_NAME]);