| 1 |
<?php if( !defined('WPINC') ) die; // If this file is called directly, abort |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: Leyka |
| 5 |
* Plugin URI: https://leyka.org/ |
| 6 |
* Description: Donations management system for your WP site. For NGOs and social projects. |
| 7 |
* Version: 3.32.3 |
| 8 |
* Author: Teplitsa of social technologies |
| 9 |
* Author URI: https://te-st.org |
| 10 |
* Text Domain: leyka |
| 11 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 12 |
* Contributors: |
| 13 |
Lev "ahaenor" Zvyagintsev (ahaenor@gmail.com) |
| 14 |
Anna "foralien" Ladoshkina (webdev@foralien.com) |
| 15 |
Vyacheslav Oleinik (oleinik.v89@gmail.com) |
| 16 |
Denis Cherniatev (denis.cherniatev@gmail.com) |
| 17 |
Ion Burdianov (burdianov@gmail.com) |
| 18 |
Marie Borisyonok (pro100mary@gmail.com) |
| 19 |
|
| 20 |
* License: GPLv2 or later |
| 21 |
Copyright (C) 2012-2023 by Teplitsa of Social Technologies (https://te-st.org). |
| 22 |
|
| 23 |
GNU General Public License, Free Software Foundation <http://www.gnu.org/licenses/gpl-2.0.html> |
| 24 |
|
| 25 |
This program is free software; you can redistribute it and/or modify |
| 26 |
it under the terms of the GNU General Public License as published by |
| 27 |
the Free Software Foundation; either version 2 of the License, or |
| 28 |
(at your option) any later version. |
| 29 |
|
| 30 |
This program is distributed in the hope that it will be useful, |
| 31 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 32 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 33 |
GNU General Public License for more details. |
| 34 |
|
| 35 |
You should have received a copy of the GNU General Public License |
| 36 |
along with this program; if not, write to the Free Software |
| 37 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 38 |
*/ |
| 39 |
|
| 40 |
// Leyka plugin version: |
| 41 |
if( !defined('LEYKA_VERSION') ) { |
| 42 |
define('LEYKA_VERSION', '3.32.3'); |
| 43 |
} |
| 44 |
|
| 45 |
// Plugin base file: |
| 46 |
if( !defined('LEYKA_PLUGIN_BASE_FILE') ) { |
| 47 |
define('LEYKA_PLUGIN_BASE_FILE', basename(__FILE__)); |
| 48 |
} |
| 49 |
|
| 50 |
// Plugin base directory: |
| 51 |
if( !defined('LEYKA_PLUGIN_DIR_NAME') ) { |
| 52 |
define('LEYKA_PLUGIN_DIR_NAME', basename(dirname(__FILE__))); |
| 53 |
} |
| 54 |
|
| 55 |
// Plugin URL: |
| 56 |
if( !defined('LEYKA_PLUGIN_BASE_URL') ) { |
| 57 |
define('LEYKA_PLUGIN_BASE_URL', plugin_dir_url(__FILE__)); |
| 58 |
} |
| 59 |
|
| 60 |
// Plugin DIR, with trailing slash: |
| 61 |
if( !defined('LEYKA_PLUGIN_DIR') ) { |
| 62 |
define('LEYKA_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 63 |
} |
| 64 |
|
| 65 |
// Plugin ID: |
| 66 |
if( !defined('LEYKA_PLUGIN_INNER_SHORT_NAME') ) { // 'leyka/leyka.php' |
| 67 |
define('LEYKA_PLUGIN_INNER_SHORT_NAME', plugin_basename(__FILE__)); |
| 68 |
} |
| 69 |
|
| 70 |
// Plugin support email: |
| 71 |
if( !defined('LEYKA_SUPPORT_EMAIL') ) { |
| 72 |
define('LEYKA_SUPPORT_EMAIL', 'help@te-st.org,sidorenko.a@gmail.com'); |
| 73 |
} |
| 74 |
|
| 75 |
if( !defined('LEYKA_DEBUG') ) { |
| 76 |
define('LEYKA_DEBUG', 'inherit'); |
| 77 |
} |
| 78 |
|
| 79 |
if( !defined('LEYKA_USAGE_STATS_DEV_SERVER_URL') ) { |
| 80 |
define('LEYKA_USAGE_STATS_DEV_SERVER_URL', 'https://ngo2.ru/leyka-usage-stats/'); |
| 81 |
} |
| 82 |
|
| 83 |
if( !defined('LEYKA_USAGE_STATS_PROD_SERVER_URL') ) { |
| 84 |
define('LEYKA_USAGE_STATS_PROD_SERVER_URL', 'https://ls.te-st.org/'); |
| 85 |
} |
| 86 |
|
| 87 |
if(get_locale() === 'ru_RU') { |
| 88 |
load_textdomain('leyka', dirname(realpath(__FILE__)).'/languages/leyka-ru_RU.mo'); // Load the lang. pack included |
| 89 |
} |
| 90 |
load_plugin_textdomain('leyka', false, basename(dirname(__FILE__)).'/languages/'); // Load the lang. pack by priority |
| 91 |
|
| 92 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-tmp-translations.php'); |
| 93 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-functions.php'); |
| 94 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-options-controller.php'); |
| 95 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-updates.php'); |
| 96 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-polylang.php'); |
| 97 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-core.php'); |
| 98 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-gateways-api.php'); |
| 99 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-extensions-api.php'); |
| 100 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-campaign.php'); |
| 101 |
|
| 102 |
require_once(LEYKA_PLUGIN_DIR.'inc/donations/leyka-class-donation-base.php'); |
| 103 |
// For old Leyka custom code that uses direct Leyka_Donation class instancing, |
| 104 |
// we should require the class code here, right in the beginning: |
| 105 |
if(in_array(get_option('leyka_donations_storage_type'), ['sep', 'sep-incompleted'])) { |
| 106 |
require_once(LEYKA_PLUGIN_DIR.'inc/donations/leyka-class-donation-separated.php'); |
| 107 |
} else { |
| 108 |
require_once(LEYKA_PLUGIN_DIR.'inc/donations/leyka-class-donation-post.php'); |
| 109 |
} |
| 110 |
require_once(LEYKA_PLUGIN_DIR.'inc/donations/leyka-class-donations-management.php'); |
| 111 |
require_once(LEYKA_PLUGIN_DIR.'inc/donations/leyka-class-donations.php'); |
| 112 |
require_once(LEYKA_PLUGIN_DIR.'inc/donations/leyka-class-donations-errors.php'); |
| 113 |
|
| 114 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-donor.php'); |
| 115 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-payment-form.php'); |
| 116 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-template-controller.php'); |
| 117 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-ajax.php'); |
| 118 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-shortcodes.php'); |
| 119 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-widgets.php'); |
| 120 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-hooks.php'); |
| 121 |
|
| 122 |
if(version_compare( $GLOBALS['wp_version'], '5.8', '>=' )) { |
| 123 |
require_once(LEYKA_PLUGIN_DIR.'editor/leyka-editor.php'); |
| 124 |
} |
| 125 |
|
| 126 |
// Automatically include all sub-dirs of /leyka/gateways/ : |
| 127 |
$gateways_dir = dir(LEYKA_PLUGIN_DIR.'gateways/'); |
| 128 |
if($gateways_dir) { |
| 129 |
|
| 130 |
while(false !== ($gateway_id = $gateways_dir->read())) { |
| 131 |
|
| 132 |
if(in_array($gateway_id, array('.', '..', 'index.php'))) { |
| 133 |
continue; |
| 134 |
} |
| 135 |
|
| 136 |
$file_addr = LEYKA_PLUGIN_DIR . 'gateways/' . $gateway_id . '/leyka-class-' . $gateway_id; |
| 137 |
|
| 138 |
if ( file_exists( $file_addr . '-gateway.php' ) ) { |
| 139 |
require_once( $file_addr . '-gateway.php' ); |
| 140 |
} |
| 141 |
|
| 142 |
} |
| 143 |
|
| 144 |
$gateways_dir->close(); |
| 145 |
|
| 146 |
} |
| 147 |
|
| 148 |
// Automatically include all sub-dirs of /leyka/extensions/ : |
| 149 |
$extensions_dir = dir(LEYKA_PLUGIN_DIR.'extensions/'); |
| 150 |
if($extensions_dir) { |
| 151 |
|
| 152 |
while(false !== ($extension_id = $extensions_dir->read())) { |
| 153 |
|
| 154 |
if(in_array($extension_id, array('.', '..', 'index.php'))) { |
| 155 |
continue; |
| 156 |
} |
| 157 |
|
| 158 |
$file_addr = LEYKA_PLUGIN_DIR."extensions/$extension_id/leyka-class-{$extension_id}-extension.php"; |
| 159 |
|
| 160 |
if(file_exists($file_addr)) { |
| 161 |
require_once($file_addr); |
| 162 |
} |
| 163 |
|
| 164 |
} |
| 165 |
|
| 166 |
$extensions_dir->close(); |
| 167 |
|
| 168 |
} |
| 169 |
|
| 170 |
if(leyka_options()->opt('donor_accounts_available')) { |
| 171 |
require_once(LEYKA_PLUGIN_DIR.'templates/account/template-tags.php'); |
| 172 |
} |
| 173 |
|
| 174 |
if( !function_exists('leyka_load_plugin_textdomain') ) { |
| 175 |
function leyka_load_plugin_textdomain() { |
| 176 |
load_plugin_textdomain('leyka', false, basename(dirname(__FILE__)).'/languages/'); |
| 177 |
} |
| 178 |
} |
| 179 |
add_action('plugins_loaded', 'leyka_load_plugin_textdomain'); |
| 180 |
|
| 181 |
register_activation_hook(__FILE__, ['Leyka', 'activate']); // Activation |
| 182 |
register_deactivation_hook(__FILE__, ['Leyka', 'deactivate']); // Deactivate |
| 183 |
|
| 184 |
add_action('init', function(){ |
| 185 |
leyka_handle_plugin_update(); // Only if needed |
| 186 |
}); |
| 187 |
|
| 188 |
leyka(); // All systems, go |
| 189 |
|