-
Notifications
You must be signed in to change notification settings - Fork 52
/
leyka.php
188 lines (146 loc) · 6.77 KB
/
leyka.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php if( !defined('WPINC') ) die; // If this file is called directly, abort
/**
* Plugin Name: Leyka
* Plugin URI: https://leyka.org/
* Description: Donations management system for your WP site. For NGOs and social projects.
* Version: 3.31.8
* Author: Teplitsa of social technologies
* Author URI: https://te-st.org
* Text Domain: leyka
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Contributors:
Lev "ahaenor" Zvyagintsev ([email protected])
Anna "foralien" Ladoshkina ([email protected])
Vyacheslav Oleinik ([email protected])
Denis Cherniatev ([email protected])
Ion Burdianov ([email protected])
Marie Borisyonok ([email protected])
* License: GPLv2 or later
Copyright (C) 2012-2023 by Teplitsa of Social Technologies (https://te-st.org).
GNU General Public License, Free Software Foundation <http://www.gnu.org/licenses/gpl-2.0.html>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Leyka plugin version:
if( !defined('LEYKA_VERSION') ) {
define('LEYKA_VERSION', '3.31.8');
}
// Plugin base file:
if( !defined('LEYKA_PLUGIN_BASE_FILE') ) {
define('LEYKA_PLUGIN_BASE_FILE', basename(__FILE__));
}
// Plugin base directory:
if( !defined('LEYKA_PLUGIN_DIR_NAME') ) {
define('LEYKA_PLUGIN_DIR_NAME', basename(dirname(__FILE__)));
}
// Plugin URL:
if( !defined('LEYKA_PLUGIN_BASE_URL') ) {
define('LEYKA_PLUGIN_BASE_URL', plugin_dir_url(__FILE__));
}
// Plugin DIR, with trailing slash:
if( !defined('LEYKA_PLUGIN_DIR') ) {
define('LEYKA_PLUGIN_DIR', plugin_dir_path(__FILE__));
}
// Plugin ID:
if( !defined('LEYKA_PLUGIN_INNER_SHORT_NAME') ) { // 'leyka/leyka.php'
define('LEYKA_PLUGIN_INNER_SHORT_NAME', plugin_basename(__FILE__));
}
// Plugin support email:
if( !defined('LEYKA_SUPPORT_EMAIL') ) {
define('LEYKA_SUPPORT_EMAIL', '[email protected],[email protected]');
}
if( !defined('LEYKA_DEBUG') ) {
define('LEYKA_DEBUG', 'inherit');
}
if( !defined('LEYKA_USAGE_STATS_DEV_SERVER_URL') ) {
define('LEYKA_USAGE_STATS_DEV_SERVER_URL', 'https://ngo2.ru/leyka-usage-stats/');
}
if( !defined('LEYKA_USAGE_STATS_PROD_SERVER_URL') ) {
define('LEYKA_USAGE_STATS_PROD_SERVER_URL', 'https://ls.te-st.org/');
}
if(get_locale() === 'ru_RU') {
load_textdomain('leyka', dirname(realpath(__FILE__)).'/languages/leyka-ru_RU.mo'); // Load the lang. pack included
}
load_plugin_textdomain('leyka', false, basename(dirname(__FILE__)).'/languages/'); // Load the lang. pack by priority
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-tmp-translations.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-functions.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-options-controller.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-updates.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-polylang.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-core.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-gateways-api.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-extensions-api.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-campaign.php');
require_once(LEYKA_PLUGIN_DIR.'inc/donations/leyka-class-donation-base.php');
// For old Leyka custom code that uses direct Leyka_Donation class instancing,
// we should require the class code here, right in the beginning:
if(in_array(get_option('leyka_donations_storage_type'), ['sep', 'sep-incompleted'])) {
require_once(LEYKA_PLUGIN_DIR.'inc/donations/leyka-class-donation-separated.php');
} else {
require_once(LEYKA_PLUGIN_DIR.'inc/donations/leyka-class-donation-post.php');
}
require_once(LEYKA_PLUGIN_DIR.'inc/donations/leyka-class-donations-management.php');
require_once(LEYKA_PLUGIN_DIR.'inc/donations/leyka-class-donations.php');
require_once(LEYKA_PLUGIN_DIR.'inc/donations/leyka-class-donations-errors.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-donor.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-payment-form.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-template-controller.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-ajax.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-shortcodes.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-widgets.php');
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-hooks.php');
if(version_compare( $GLOBALS['wp_version'], '5.8', '>=' )) {
require_once(LEYKA_PLUGIN_DIR.'editor/leyka-editor.php');
}
// Automatically include all sub-dirs of /leyka/gateways/ :
$gateways_dir = dir(LEYKA_PLUGIN_DIR.'gateways/');
if($gateways_dir) {
while(false !== ($gateway_id = $gateways_dir->read())) {
if(in_array($gateway_id, array('.', '..', 'index.php'))) {
continue;
}
$file_addr = LEYKA_PLUGIN_DIR . 'gateways/' . $gateway_id . '/leyka-class-' . $gateway_id;
if ( file_exists( $file_addr . '-gateway.php' ) ) {
require_once( $file_addr . '-gateway.php' );
}
}
$gateways_dir->close();
}
// Automatically include all sub-dirs of /leyka/extensions/ :
$extensions_dir = dir(LEYKA_PLUGIN_DIR.'extensions/');
if($extensions_dir) {
while(false !== ($extension_id = $extensions_dir->read())) {
if(in_array($extension_id, array('.', '..', 'index.php'))) {
continue;
}
$file_addr = LEYKA_PLUGIN_DIR."extensions/$extension_id/leyka-class-{$extension_id}-extension.php";
if(file_exists($file_addr)) {
require_once($file_addr);
}
}
$extensions_dir->close();
}
if(leyka_options()->opt('donor_accounts_available')) {
require_once(LEYKA_PLUGIN_DIR.'templates/account/template-tags.php');
}
if( !function_exists('leyka_load_plugin_textdomain') ) {
function leyka_load_plugin_textdomain() {
load_plugin_textdomain('leyka', false, basename(dirname(__FILE__)).'/languages/');
}
}
add_action('plugins_loaded', 'leyka_load_plugin_textdomain');
register_activation_hook(__FILE__, ['Leyka', 'activate']); // Activation
register_deactivation_hook(__FILE__, ['Leyka', 'deactivate']); // Deactivate
add_action('init', function(){
leyka_handle_plugin_update(); // Only if needed
});
leyka(); // All systems, go