-
Notifications
You must be signed in to change notification settings - Fork 2
/
utils.php
54 lines (47 loc) · 1.32 KB
/
utils.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @package VikSslCommercePay
* @subpackage core
* @author E4J s.r.l.
* @copyright Copyright (C) 2018 SslCommercePay All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @link https://sslcommercepay.io
*/
// No direct access
defined('ABSPATH') or die('No script kiddies please!');
// Define plugin base path
define('VIKSSLCOMMERZ_DIR', dirname(__FILE__));
// Define plugin base URI
define('VIKSSLCOMMERZ_URI', plugin_dir_url(__FILE__));
/**
* Imports the file of the gateway and returns the classname
* of the file that will be instantiated by the caller.
*
* @param string $plugin The name of the caller.
*
* @return mixed The classname of the payment if exists, otherwise false.
*/
function viksslcommerz_load_payment($plugin)
{
if (!JLoader::import("{$plugin}.sslcommerz", VIKSSLCOMMERZ_DIR))
{
return false;
}
return ucwords($plugin) . 'SslcommerzPayment';
}
/**
* Returns the path in which the payment is located.
*
* @param string $plugin The name of the caller.
*
* @return mixed The path if exists, otherwise false.
*/
function viksslcommerz_get_payment_path($plugin)
{
$path = VIKSSLCOMMERZ_DIR . DIRECTORY_SEPARATOR . $plugin . DIRECTORY_SEPARATOR . 'sslcommerz.php';
if (!is_file($path))
{
return false;
}
return $path;
}