This repository has been archived by the owner on Oct 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wp-e-commerce-gateway-paygate.php
executable file
·92 lines (82 loc) · 3.07 KB
/
wp-e-commerce-gateway-paygate.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/**
* Plugin Name: PayGate PayWeb3 plugin for WP eCommerce
* Plugin URI: https://github.com/PayGate/PayWeb_WP_eCommerce
* Description: Accept payments for WP eCommerce using PayGate's PayWeb3 service
* Version: 1.0.4
* Author: PayGate (Pty) Ltd
* Author URI: https://www.paygate.co.za/
* Developer: App Inlet (Pty) Ltd
* Developer URI: https://www.appinlet.com/
*
* Copyright: © 2018 PayGate (Pty) Ltd.
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
function paygate_activation()
{
/**
* Filters the path of the file to create.
*
* @since 1.0.3
*
* @param string $file Path to the file to create.
*/
$plugin_dir = plugin_dir_path( __FILE__ ) . 'library/paygate.php';
$plugin_path = plugin_dir_path( __FILE__ );
$r = 'wp-e-commerce-gateway-paygate/';
$plugin_path = str_replace( $r, '', $plugin_path );
$theme_dir = $plugin_path . 'wp-e-commerce/wpsc-merchants/paygate.php';
if ( !copy( $plugin_dir, $theme_dir ) ) {
echo "failed to copy $plugin_dir to $theme_dir...\n";
}
}
register_activation_hook( __FILE__, 'paygate_activation' );
function paygate_init()
{
/**
* Auto updates from GIT
*
* @since 1.0.4
*
*/
require_once 'library/updater.class.php';
if ( is_admin() ) {
// note the use of is_admin() to double check that this is happening in the admin
$config = array(
'slug' => plugin_basename( __FILE__ ),
'proper_folder_name' => 'wp-e-commerce-gateway-paygate',
'api_url' => 'https://api.github.com/repos/PayGate/PayWeb_WP_eCommerce',
'raw_url' => 'https://raw.github.com/PayGate/PayWeb_WP_eCommerce/master',
'github_url' => 'https://github.com/PayGate/PayWeb_WP_eCommerce',
'zip_url' => 'https://github.com/PayGate/PayWeb_WP_eCommerce/archive/master.zip',
'homepage' => 'https://github.com/PayGate/PayWeb_WP_eCommerce',
'sslverify' => true,
'requires' => '4.0',
'tested' => '4.9.8',
'readme' => 'README.md',
'access_token' => '',
);
new WP_GitHub_Updater( $config );
}
}
add_action( 'plugins_loaded', 'paygate_init', 0 );
function paygate_deactivation()
{
/**
* Filters the path of the file to delete.
*
* @since 1.0.3
*
* @param string $file Path to the file to delete.
*/
$plugin_path = plugin_dir_path( __FILE__ );
$r = 'wp-e-commerce-gateway-paygate/';
$plugin_path = str_replace( $r, '', $plugin_path );
$theme_dir = $plugin_path . 'wp-e-commerce/wpsc-merchants/paygate.php';
$delete = apply_filters( 'paygate_deactivation', $theme_dir );
if ( !empty( $delete ) ) {
@unlink( $delete );
}
}
register_deactivation_hook( __FILE__, 'paygate_deactivation' );