| @@ -1,139 +1,244 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Plugin Name: TaxoPress | |
| 4 | - * Plugin URI: https://wordpress.org/plugins/simple-tags/ | |
| 5 | - * Description: TaxoPress allows you to create and manage Tags, Categories, and all your WordPress taxonomy terms. | |
| 6 | - * Version: 3.44.0 | |
| 7 | - * Author: TaxoPress | |
| 8 | - * Author URI: https://taxopress.com | |
| 9 | - * Text Domain: simple-tags | |
| 10 | - * Domain Path: /languages | |
| 11 | - * Min WP Version: 4.9.7 | |
| 12 | - * Requires PHP: 7.4 | |
| 13 | - * License: GPLv3 | |
| 14 | - * | |
| 15 | - * Copyright (c) 2022 Taxopress | |
| 16 | - * | |
| 17 | - * @package simple-tags | |
| 18 | - * @author TaxoPress | |
| 19 | - * @copyright Copyright (c) 2022 Taxopress | |
| 20 | - * @license GNU General Public License version 2 | |
| 21 | - * @link https://TaxoPress.com/ | |
| 22 | - */ | |
| 23 | - | |
| 24 | -###################################### | |
| 25 | -/* | |
| 26 | -This program is free software; you can redistribute it and/or modify | |
| 27 | -it under the terms of the GNU General Public License as published by | |
| 28 | -the Free Software Foundation; either version 2 of the License, or | |
| 29 | -(at your option) any later version. | |
| 30 | - | |
| 31 | -This program is distributed in the hope that it will be useful, | |
| 32 | -but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 33 | -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 34 | -GNU General Public License for more details. | |
| 35 | - | |
| 36 | -Contributors to the TaxoPress code include: | |
| 37 | - - Kevin Drouvin (kevin.drouvin@gmail.com - http://inside-dev.net) | |
| 38 | - - Martin Modler (modler@webformatik.com - http://www.webformatik.com) | |
| 39 | - - Vladimir Kolesnikov (vladimir@extrememember.com - http://blog.sjinks.pro) | |
| 40 | - | |
| 41 | -Sections of the TaxoPress code are based on Custom Post Type UI by WebDevStudios. | |
| 42 | - | |
| 43 | -Credits Icons : | |
| 44 | - - famfamfam - http://www.famfamfam.com/lab/icons/silk/ | |
| 45 | - | |
| 46 | -*/ | |
| 47 | - | |
| 48 | -// don't load directly | |
| 49 | -if (!defined('ABSPATH')) { | |
| 50 | - die('-1'); | |
| 51 | -} | |
| 52 | - | |
| 53 | -if (!defined('STAGS_VERSION')) { | |
| 54 | -define('STAGS_VERSION', '3.44.0'); | |
| 55 | -} | |
| 56 | - | |
| 57 | - | |
| 58 | -$pro_active = false; | |
| 59 | - | |
| 60 | -foreach ((array)get_option('active_plugins') as $plugin_file) { | |
| 61 | - if (false !== strpos($plugin_file, 'taxopress-pro.php')) { | |
| 62 | - $pro_active = true; | |
| 63 | - break; | |
| 64 | - } | |
| 65 | -} | |
| 66 | - | |
| 67 | -if (!$pro_active && is_multisite()) { | |
| 68 | - foreach (array_keys((array)get_site_option('active_sitewide_plugins')) as $plugin_file) { | |
| 69 | - if (false !== strpos($plugin_file, 'taxopress-pro.php')) { | |
| 70 | - $pro_active = true; | |
| 71 | - break; | |
| 72 | - } | |
| 73 | - } | |
| 74 | -} | |
| 75 | - | |
| 76 | -if ($pro_active) { | |
| 77 | - add_filter( | |
| 78 | - 'plugin_row_meta', | |
| 79 | - function($links, $file) | |
| 80 | - { | |
| 81 | - if ($file == plugin_basename(__FILE__)) { | |
| 82 | - $links[]= __('<strong>This plugin can be deleted.</strong>', 'simple-tags'); | |
| 83 | - } | |
| 84 | - | |
| 85 | - return $links; | |
| 86 | - }, | |
| 87 | - 10, 2 | |
| 88 | - ); | |
| 89 | -} | |
| 90 | - | |
| 91 | -if (defined('TAXOPRESS_FILE') || $pro_active) { | |
| 92 | - if(!function_exists('deactivate_plugins')){ | |
| 93 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 94 | - } | |
| 95 | - //deactivate current plugin if pro is active | |
| 96 | - deactivate_plugins( plugin_basename( __FILE__ ) ); | |
| 97 | - return; | |
| 98 | -} | |
| 99 | - | |
| 100 | - | |
| 101 | - | |
| 102 | -define ( 'TAXOPRESS_FILE', __FILE__ ); | |
| 103 | - | |
| 104 | -define('STAGS_MIN_PHP_VERSION', '7.4'); | |
| 105 | -define('STAGS_OPTIONS_NAME', 'simpletags'); // Option name for save settings | |
| 106 | -define('STAGS_OPTIONS_NAME_AUTO', 'simpletags-auto'); // Option name for save settings auto terms | |
| 107 | - | |
| 108 | -define('STAGS_URL', plugins_url('', __FILE__)); | |
| 109 | -define('STAGS_DIR', rtrim(plugin_dir_path(__FILE__), '/')); | |
| 110 | -define('TAXOPRESS_ABSPATH', __DIR__); | |
| 111 | - | |
| 112 | -// Check PHP min version | |
| 113 | -if (version_compare(PHP_VERSION, STAGS_MIN_PHP_VERSION, '<')) { | |
| 114 | - require STAGS_DIR . '/inc/class.compatibility.php'; | |
| 115 | - | |
| 116 | - // possibly display a notice, trigger error | |
| 117 | - add_action('admin_init', array('SimpleTags_Compatibility', 'admin_init')); | |
| 118 | - | |
| 119 | - // stop execution of this file | |
| 120 | - return; | |
| 121 | -} | |
| 122 | - | |
| 123 | -require STAGS_DIR . '/inc/loads.php'; | |
| 124 | - | |
| 125 | -// Init TaxoPress | |
| 126 | -function init_free_simple_tags() | |
| 127 | -{ | |
| 128 | - if (is_admin() && !defined('TAXOPRESS_PRO_VERSION')) { | |
| 129 | - require_once(TAXOPRESS_ABSPATH . '/includes-core/TaxopressCoreAdmin.php'); | |
| 130 | - new \PublishPress\Taxopress\TaxopressCoreAdmin(); | |
| 131 | - } | |
| 132 | -} | |
| 133 | -add_action('init', 'init_free_simple_tags', 0); | |
| 134 | - | |
| 135 | -// Activation, uninstall | |
| 136 | -register_activation_hook(__FILE__, array('SimpleTags_Plugin', 'activation')); | |
| 137 | -register_deactivation_hook(__FILE__, array('SimpleTags_Plugin', 'deactivation')); | |
| 138 | - | |
| 139 | -add_action('init', 'init_simple_tags', 0); | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Plugin Name: TaxoPress | |
| 5 | + * Plugin URI: https://wordpress.org/plugins/simple-tags/ | |
| 6 | + * Description: TaxoPress allows you to create and manage Tags, Categories, and all your WordPress taxonomy terms. | |
| 7 | + * Version: 3.53.0 | |
| 8 | + * Author: TaxoPress | |
| 9 | + * Author URI: https://taxopress.com | |
| 10 | + * Text Domain: simple-tags | |
| 11 | + * Domain Path: /languages | |
| 12 | + * Min WP Version: 4.9.7 | |
| 13 | + * Requires PHP: 7.4 | |
| 14 | + * License: GPLv3 | |
| 15 | + * | |
| 16 | + * Copyright (c) 2022 Taxopress | |
| 17 | + * | |
| 18 | + * @package simple-tags | |
| 19 | + * @author TaxoPress | |
| 20 | + * @copyright Copyright (c) 2022 Taxopress | |
| 21 | + * @license GNU General Public License version 2 | |
| 22 | + * @link https://TaxoPress.com/ | |
| 23 | + */ | |
| 24 | + | |
| 25 | +###################################### | |
| 26 | +/* | |
| 27 | +This program is free software; you can redistribute it and/or modify | |
| 28 | +it under the terms of the GNU General Public License as published by | |
| 29 | +the Free Software Foundation; either version 2 of the License, or | |
| 30 | +(at your option) any later version. | |
| 31 | + | |
| 32 | +This program is distributed in the hope that it will be useful, | |
| 33 | +but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 34 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 35 | +GNU General Public License for more details. | |
| 36 | + | |
| 37 | +Contributors to the TaxoPress code include: | |
| 38 | + - Kevin Drouvin (kevin.drouvin@gmail.com - http://inside-dev.net) | |
| 39 | + - Martin Modler (modler@webformatik.com - http://www.webformatik.com) | |
| 40 | + - Vladimir Kolesnikov (vladimir@extrememember.com - http://blog.sjinks.pro) | |
| 41 | + | |
| 42 | +Sections of the TaxoPress code are based on Custom Post Type UI by WebDevStudios. | |
| 43 | + | |
| 44 | +Credits Icons : | |
| 45 | + - famfamfam - http://www.famfamfam.com/lab/icons/silk/ | |
| 46 | + | |
| 47 | +*/ | |
| 48 | + | |
| 49 | +// don't load directly | |
| 50 | +if (!defined('ABSPATH')) { | |
| 51 | + die('-1'); | |
| 52 | +} | |
| 53 | + | |
| 54 | +if (!defined('STAGS_VERSION')) { | |
| 55 | + define('STAGS_VERSION', '3.53.0'); | |
| 56 | +} | |
| 57 | + | |
| 58 | +if (! function_exists('taxopress_free_is_pro_active')) { | |
| 59 | + function taxopress_free_is_pro_active() | |
| 60 | + { | |
| 61 | + if (defined('TAXOPRESS_PRO_FILE') || defined('TAXOPRESS_PRO_VERSION')) { | |
| 62 | + return true; | |
| 63 | + } | |
| 64 | + | |
| 65 | + if (! function_exists('get_option')) { | |
| 66 | + return false; | |
| 67 | + } | |
| 68 | + | |
| 69 | + $pro_active = false; | |
| 70 | + | |
| 71 | + foreach ((array) get_option('active_plugins') as $plugin_file) { | |
| 72 | + if (false !== strpos($plugin_file, 'taxopress-pro/taxopress-pro.php')) { | |
| 73 | + $pro_active = true; | |
| 74 | + break; | |
| 75 | + } | |
| 76 | + } | |
| 77 | + | |
| 78 | + if (! $pro_active && function_exists('is_multisite') && is_multisite()) { | |
| 79 | + foreach (array_keys((array) get_site_option('active_sitewide_plugins')) as $plugin_file) { | |
| 80 | + if (false !== strpos($plugin_file, 'taxopress-pro/taxopress-pro.php')) { | |
| 81 | + $pro_active = true; | |
| 82 | + break; | |
| 83 | + } | |
| 84 | + } | |
| 85 | + } | |
| 86 | + | |
| 87 | + return $pro_active; | |
| 88 | + } | |
| 89 | +} | |
| 90 | + | |
| 91 | +if (taxopress_free_is_pro_active()) { | |
| 92 | + if (is_admin()) { | |
| 93 | + add_filter( | |
| 94 | + 'plugin_row_meta', | |
| 95 | + function ($links, $file) { | |
| 96 | + if ($file === plugin_basename(__FILE__)) { | |
| 97 | + $links[] = '<strong>' . esc_html__('This plugin can be deleted.', 'simple-tags') . '</strong>'; | |
| 98 | + } | |
| 99 | + | |
| 100 | + return $links; | |
| 101 | + }, | |
| 102 | + 10, | |
| 103 | + 2 | |
| 104 | + ); | |
| 105 | + | |
| 106 | + add_action('admin_init', function () { | |
| 107 | + if (! function_exists('deactivate_plugins')) { | |
| 108 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 109 | + } | |
| 110 | + | |
| 111 | + if (function_exists('is_plugin_active') && is_plugin_active(plugin_basename(__FILE__))) { | |
| 112 | + deactivate_plugins(plugin_basename(__FILE__)); | |
| 113 | + set_transient('taxopress_free_deactivated_due_to_pro', 1, 30); | |
| 114 | + } | |
| 115 | + }); | |
| 116 | + | |
| 117 | + add_action('admin_notices', function () { | |
| 118 | + if (! get_transient('taxopress_free_deactivated_due_to_pro')) { | |
| 119 | + return; | |
| 120 | + } | |
| 121 | + | |
| 122 | + delete_transient('taxopress_free_deactivated_due_to_pro'); | |
| 123 | + | |
| 124 | + echo '<div class="notice notice-warning is-dismissible"><p>' | |
| 125 | + . esc_html__('TaxoPress was not activated because TaxoPress Pro is already active. Please keep only TaxoPress Pro enabled.', 'simple-tags') | |
| 126 | + . '</p></div>'; | |
| 127 | + }); | |
| 128 | + } | |
| 129 | + | |
| 130 | + return; | |
| 131 | +} | |
| 132 | + | |
| 133 | +$includeFileRelativePath = '/publishpress/instance-protection/include.php'; | |
| 134 | + | |
| 135 | +if (file_exists(__DIR__ . '/lib/vendor' . $includeFileRelativePath)) { | |
| 136 | + require_once __DIR__ . '/lib/vendor' . $includeFileRelativePath; | |
| 137 | +} elseif (defined('STAGS_LIB_VENDOR_PATH') && file_exists(STAGS_LIB_VENDOR_PATH . $includeFileRelativePath)) { | |
| 138 | + require_once STAGS_LIB_VENDOR_PATH . $includeFileRelativePath; | |
| 139 | +} | |
| 140 | + | |
| 141 | +if (class_exists('PublishPressInstanceProtection\\Config')) { | |
| 142 | + $pluginCheckerConfig = new PublishPressInstanceProtection\Config(); | |
| 143 | + $pluginCheckerConfig->pluginSlug = 'simple-tags'; | |
| 144 | + $pluginCheckerConfig->pluginName = 'TaxoPress'; | |
| 145 | + | |
| 146 | + $pluginChecker = new PublishPressInstanceProtection\InstanceChecker($pluginCheckerConfig); | |
| 147 | +} | |
| 148 | + | |
| 149 | +$bundledTranslationsPath = '/publishpress/bundled-translations/core/include.php'; | |
| 150 | + | |
| 151 | +if (file_exists(__DIR__ . '/lib/vendor' . $bundledTranslationsPath)) { | |
| 152 | + require_once __DIR__ . '/lib/vendor' . $bundledTranslationsPath; | |
| 153 | +} elseif (defined('STAGS_LIB_VENDOR_PATH') && file_exists(STAGS_LIB_VENDOR_PATH . $bundledTranslationsPath)) { | |
| 154 | + require_once STAGS_LIB_VENDOR_PATH . $bundledTranslationsPath; | |
| 155 | +} | |
| 156 | + | |
| 157 | +$autoloadPath = __DIR__ . '/lib/vendor/autoload.php'; | |
| 158 | +if (!file_exists($autoloadPath)) { | |
| 159 | + $autoloadPath = __DIR__ . '/vendor/autoload.php'; | |
| 160 | +} | |
| 161 | +if (file_exists($autoloadPath)) { | |
| 162 | + require_once $autoloadPath; | |
| 163 | +} | |
| 164 | + | |
| 165 | +add_action('plugins_loaded', function () { | |
| 166 | + if (class_exists('PublishPress\BundledTranslations\BundledTranslations')) { | |
| 167 | + $bundledTranslations = new PublishPress\BundledTranslations\BundledTranslations( | |
| 168 | + 'simple-tags', | |
| 169 | + __DIR__ . '/languages', | |
| 170 | + __FILE__ | |
| 171 | + ); | |
| 172 | + $bundledTranslations->init(); | |
| 173 | + } | |
| 174 | +}, 10); | |
| 175 | + | |
| 176 | +$wordpressVersionNoticesPath = '/publishpress/wordpress-version-notices/src/include.php'; | |
| 177 | + | |
| 178 | +if (file_exists(__DIR__ . '/lib/vendor' . $wordpressVersionNoticesPath)) { | |
| 179 | + require_once __DIR__ . '/lib/vendor' . $wordpressVersionNoticesPath; | |
| 180 | +} elseif (defined('STAGS_LIB_VENDOR_PATH') && file_exists(STAGS_LIB_VENDOR_PATH . $wordpressVersionNoticesPath)) { | |
| 181 | + require_once STAGS_LIB_VENDOR_PATH . $wordpressVersionNoticesPath; | |
| 182 | +} | |
| 183 | + | |
| 184 | + | |
| 185 | +if (! defined('TAXOPRESS_FILE')) { | |
| 186 | + define('TAXOPRESS_FILE', __FILE__); | |
| 187 | +} | |
| 188 | + | |
| 189 | +if (! defined('STAGS_MIN_PHP_VERSION')) { | |
| 190 | + define('STAGS_MIN_PHP_VERSION', '7.4'); | |
| 191 | +} | |
| 192 | + | |
| 193 | +if (! defined('STAGS_OPTIONS_NAME')) { | |
| 194 | + define('STAGS_OPTIONS_NAME', 'simpletags'); // Option name for save settings | |
| 195 | +} | |
| 196 | + | |
| 197 | +if (! defined('STAGS_OPTIONS_NAME_AUTO')) { | |
| 198 | + define('STAGS_OPTIONS_NAME_AUTO', 'simpletags-auto'); // Option name for save settings auto terms | |
| 199 | +} | |
| 200 | + | |
| 201 | +if (! defined('STAGS_URL')) { | |
| 202 | + define('STAGS_URL', plugins_url('', __FILE__)); | |
| 203 | +} | |
| 204 | + | |
| 205 | +if (! defined('STAGS_DIR')) { | |
| 206 | + define('STAGS_DIR', rtrim(plugin_dir_path(__FILE__), '/')); | |
| 207 | +} | |
| 208 | + | |
| 209 | +if (! defined('TAXOPRESS_ABSPATH')) { | |
| 210 | + define('TAXOPRESS_ABSPATH', __DIR__); | |
| 211 | +} | |
| 212 | + | |
| 213 | +if (! defined('STAGS_LIB_VENDOR_PATH')) { | |
| 214 | + define('STAGS_LIB_VENDOR_PATH', __DIR__ . '/lib/vendor'); | |
| 215 | +} | |
| 216 | + | |
| 217 | +// Check PHP min version | |
| 218 | +if (version_compare(PHP_VERSION, STAGS_MIN_PHP_VERSION, '<')) { | |
| 219 | + require STAGS_DIR . '/inc/class.compatibility.php'; | |
| 220 | + | |
| 221 | + // possibly display a notice, trigger error | |
| 222 | + add_action('admin_init', array('SimpleTags_Compatibility', 'admin_init')); | |
| 223 | + | |
| 224 | + // stop execution of this file | |
| 225 | + return; | |
| 226 | +} | |
| 227 | + | |
| 228 | +require STAGS_DIR . '/inc/loads.php'; | |
| 229 | + | |
| 230 | +// Init TaxoPress | |
| 231 | +function init_free_simple_tags() | |
| 232 | +{ | |
| 233 | + if (is_admin() && !defined('TAXOPRESS_PRO_VERSION')) { | |
| 234 | + require_once(TAXOPRESS_ABSPATH . '/includes-core/TaxopressCoreAdmin.php'); | |
| 235 | + new \PublishPress\Taxopress\TaxopressCoreAdmin(); | |
| 236 | + } | |
| 237 | +} | |
| 238 | +add_action('init', 'init_free_simple_tags', 0); | |
| 239 | + | |
| 240 | +// Activation, uninstall | |
| 241 | +register_activation_hook(__FILE__, array('SimpleTags_Plugin', 'activation')); | |
| 242 | +register_deactivation_hook(__FILE__, array('SimpleTags_Plugin', 'deactivation')); | |
| 243 | + | |
| 244 | +add_action('init', 'init_simple_tags', 0); | |