Repository navigation
Expand file tree
/
Copy pathutils.php
More file actions
56 lines (49 loc) · 1.42 KB
/
Copy pathutils.php
File metadata and controls
56 lines (49 loc) · 1.42 KB
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
55
56
<?php
/**
* @package vikmypay
* @subpackage core
* @author E4J s.r.l.
* @copyright Copyright (C) 2018 VikWP All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @link https://vikwp.com
*/
// No direct access
defined('ABSPATH') or die('No script kiddies please!');
// Define plugin base path
define('VIKMYPAY_DIR', dirname(__FILE__));
// Define plugin base URI
define('VIKMYPAY_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 vikmypay_load_payment($plugin)
{
if (!JLoader::import("{$plugin}.mypay", VIKMYPAY_DIR))
{
// there is not a version available for the given plugin
return false;
}
return ucwords($plugin) . 'MyPayPayment';
}
/**
* 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 vikmypay_get_payment_path($plugin)
{
$path = VIKMYPAY_DIR . DIRECTORY_SEPARATOR . $plugin . DIRECTORY_SEPARATOR . 'mypay.php';
if (!is_file($path))
{
// there is not a version available for the given plugin
return false;
}
return $path;
}