| 1 |
<?php if( !defined('WPINC') ) die; // If this file is called directly, abort |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: Leyka |
| 5 |
* Plugin URI: https://leyka.te-st.ru/ |
| 6 |
* Description: The donations management system for your WP site |
| 7 |
* Version: 3.9 |
| 8 |
* Author: Teplitsa of social technologies |
| 9 |
* Author URI: https://te-st.ru |
| 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 |
Denis Cherniatev (denis.cherniatev@gmail.com) |
| 16 |
Marie Borisyonok (pro100mary@gmail.com) |
| 17 |
Vladimir Petrozavodsky (petrozavodsky@gmail.com) |
| 18 |
|
| 19 |
* License: GPLv2 or later |
| 20 |
Copyright (C) 2012-2019 by Teplitsa of Social Technologies (http://te-st.ru). |
| 21 |
|
| 22 |
GNU General Public License, Free Software Foundation <http://www.gnu.org/licenses/gpl-2.0.html> |
| 23 |
|
| 24 |
This program is free software; you can redistribute it and/or modify |
| 25 |
it under the terms of the GNU General Public License as published by |
| 26 |
the Free Software Foundation; either version 2 of the License, or |
| 27 |
(at your option) any later version. |
| 28 |
|
| 29 |
This program is distributed in the hope that it will be useful, |
| 30 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 31 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 32 |
GNU General Public License for more details. |
| 33 |
|
| 34 |
You should have received a copy of the GNU General Public License |
| 35 |
along with this program; if not, write to the Free Software |
| 36 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 37 |
*/ |
| 38 |
|
| 39 |
// Leyka plugin version: |
| 40 |
if( !defined('LEYKA_VERSION') ) { |
| 41 |
define('LEYKA_VERSION', '3.9'); |
| 42 |
} |
| 43 |
|
| 44 |
// Plugin base file: |
| 45 |
if( !defined('LEYKA_PLUGIN_BASE_FILE') ) { |
| 46 |
define('LEYKA_PLUGIN_BASE_FILE', basename(__FILE__)); |
| 47 |
} |
| 48 |
|
| 49 |
// Plugin base directory: |
| 50 |
if( !defined('LEYKA_PLUGIN_DIR_NAME') ) { |
| 51 |
define('LEYKA_PLUGIN_DIR_NAME', basename(dirname(__FILE__))); |
| 52 |
} |
| 53 |
|
| 54 |
// Plugin URL: |
| 55 |
if( !defined('LEYKA_PLUGIN_BASE_URL') ) { |
| 56 |
define('LEYKA_PLUGIN_BASE_URL', plugin_dir_url(__FILE__)); |
| 57 |
} |
| 58 |
|
| 59 |
// Plugin DIR, with trailing slash: |
| 60 |
if( !defined('LEYKA_PLUGIN_DIR') ) { |
| 61 |
define('LEYKA_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 62 |
} |
| 63 |
|
| 64 |
// Plugin ID: |
| 65 |
if( !defined('LEYKA_PLUGIN_INNER_SHORT_NAME') ) { // "leyka/leyka.php" |
| 66 |
define('LEYKA_PLUGIN_INNER_SHORT_NAME', plugin_basename(__FILE__)); |
| 67 |
} |
| 68 |
|
| 69 |
// Plugin support email: |
| 70 |
if( !defined('LEYKA_SUPPORT_EMAIL') ) { |
| 71 |
define('LEYKA_SUPPORT_EMAIL', 'support@te-st.ru,sidorenko.a@gmail.com'); |
| 72 |
} |
| 73 |
|
| 74 |
if( !defined('LEYKA_DEBUG') ) { |
| 75 |
define('LEYKA_DEBUG', false); |
| 76 |
} |
| 77 |
|
| 78 |
if( !defined('LEYKA_USAGE_STATS_DEV_SERVER_URL') ) { |
| 79 |
define('LEYKA_USAGE_STATS_DEV_SERVER_URL', 'https://ngo2.ru/leyka-usage-stats/'); |
| 80 |
} |
| 81 |
|
| 82 |
if( !defined('LEYKA_USAGE_STATS_PROD_SERVER_URL') ) { |
| 83 |
define('LEYKA_USAGE_STATS_PROD_SERVER_URL', 'https://ls.te-st.ru/'); |
| 84 |
} |
| 85 |
|
| 86 |
if(get_locale() === 'ru_RU') { |
| 87 |
load_textdomain('leyka', dirname(realpath(__FILE__)).'/languages/leyka-ru_RU.mo'); // Load the lang. pack included |
| 88 |
} |
| 89 |
load_plugin_textdomain('leyka', false, basename(dirname(__FILE__)).'/languages/'); // Load the lang. pack by priority |
| 90 |
|
| 91 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-tmp-translations.php'); |
| 92 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-functions.php'); |
| 93 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-options-controller.php'); |
| 94 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-polylang.php'); |
| 95 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-core.php'); |
| 96 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-gateways-api.php'); |
| 97 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-extensions-api.php'); /** @todo Rename to class-modules-api, when Modules root class is ready? */ |
| 98 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-campaign.php'); |
| 99 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-donation.php'); |
| 100 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-donor.php'); |
| 101 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-payment-form.php'); |
| 102 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-class-template-controller.php'); |
| 103 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-ajax.php'); |
| 104 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-shortcodes.php'); |
| 105 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-widgets.php'); |
| 106 |
require_once(LEYKA_PLUGIN_DIR.'inc/leyka-hooks.php'); |
| 107 |
//require_once(ABSPATH.'wp-admin/includes/meta-boxes.php'); |
| 108 |
|
| 109 |
// Automatically include all sub-dirs of /leyka/gateways/ : |
| 110 |
$gateways_dir = dir(LEYKA_PLUGIN_DIR.'gateways/'); |
| 111 |
if($gateways_dir) { |
| 112 |
|
| 113 |
while(false !== ($gateway_id = $gateways_dir->read())) { |
| 114 |
|
| 115 |
$file_addr = LEYKA_PLUGIN_DIR."gateways/$gateway_id/leyka-class-$gateway_id-gateway.php"; |
| 116 |
|
| 117 |
if($gateway_id !== '.' && $gateway_id !== '..' && file_exists($file_addr)) { |
| 118 |
require_once($file_addr); |
| 119 |
} |
| 120 |
|
| 121 |
} |
| 122 |
|
| 123 |
$gateways_dir->close(); |
| 124 |
|
| 125 |
} |
| 126 |
|
| 127 |
// Automatically include all sub-dirs of /leyka/extensions/ : |
| 128 |
$extensions_dir = dir(LEYKA_PLUGIN_DIR.'extensions/'); |
| 129 |
if($extensions_dir) { |
| 130 |
|
| 131 |
while(false !== ($extension_id = $extensions_dir->read())) { |
| 132 |
|
| 133 |
$file_addr = LEYKA_PLUGIN_DIR."extensions/$extension_id/leyka-class-{$extension_id}-extension.php"; |
| 134 |
|
| 135 |
if($extension_id !== '.' && $extension_id !== '..' && file_exists($file_addr)) { |
| 136 |
require_once($file_addr); |
| 137 |
} |
| 138 |
|
| 139 |
} |
| 140 |
|
| 141 |
$extensions_dir->close(); |
| 142 |
|
| 143 |
} |
| 144 |
|
| 145 |
if(leyka_options()->opt('donor_accounts_available')) { |
| 146 |
require_once(LEYKA_PLUGIN_DIR.'templates/account/template-tags.php'); |
| 147 |
} |
| 148 |
|
| 149 |
function leyka_load_plugin_textdomain() { |
| 150 |
load_plugin_textdomain('leyka', false, basename(dirname(__FILE__)).'/languages/'); |
| 151 |
} |
| 152 |
add_action('plugins_loaded', 'leyka_load_plugin_textdomain'); |
| 153 |
|
| 154 |
register_activation_hook(__FILE__, array('Leyka', 'activate')); // Activation |
| 155 |
register_deactivation_hook(__FILE__, array('Leyka', 'deactivate')); // Deactivate |
| 156 |
|
| 157 |
leyka(); // All systems go |