| @@ -1,35 +1,30 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 2 | 3 | /** |
| 3 | 4 | * Plugin Name: TaxoPress |
| 4 | 5 | * Plugin URI: https://wordpress.org/plugins/simple-tags/ |
| 5 | - * Description: Extended Tag Manager. Terms suggestion, Mass Edit Terms, Auto link Terms, Ajax Autocompletion, Click Terms, Advanced manage terms, etc. | |
| 6 | - * Version: 3.6.0 | |
| 6 | + * Description: TaxoPress allows you to create and manage Tags, Categories, and all your WordPress taxonomy terms. | |
| 7 | + * Version: 3.53.0 | |
| 7 | 8 | * Author: TaxoPress |
| 8 | 9 | * Author URI: https://taxopress.com |
| 9 | 10 | * Text Domain: simple-tags |
| 10 | 11 | * Domain Path: /languages |
| 11 | 12 | * Min WP Version: 4.9.7 |
| 12 | - * Requires PHP: 5.6 | |
| 13 | + * Requires PHP: 7.4 | |
| 13 | 14 | * License: GPLv3 |
| 14 | 15 | * |
| 15 | 16 | * Copyright (c) 2022 Taxopress |
| 16 | 17 | * |
| 17 | - * ------------------------------------------------------------------------------ | |
| 18 | - * Based on Organize Series | |
| 19 | - * Author: Darren Ethier | |
| 20 | - * Copyright (c) 2007, 2011 Darren Ethier | |
| 21 | - * ------------------------------------------------------------------------------ | |
| 22 | - * | |
| 23 | - * @package simple-tags | |
| 24 | - * @author TaxoPress | |
| 25 | - * @copyright Copyright (C) 2007, 2011 Darren Ethier; modifications Copyright (C) 2022 TaxoPress | |
| 26 | - * @license GNU General Public License version 2 | |
| 27 | - * @link https://taxoPress.com/ | |
| 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/ | |
| 28 | 23 | */ |
| 29 | 24 | |
| 30 | 25 | ###################################### |
| 31 | -/* | |
| 26 | +/* | |
| 32 | 27 | This program is free software; you can redistribute it and/or modify |
| 33 | 28 | it under the terms of the GNU General Public License as published by |
| 34 | 29 | the Free Software Foundation; either version 2 of the License, or |
| 35 | 30 | (at your option) any later version. |
| @@ -56,66 +51,170 @@ | ||
| 56 | 51 | die('-1'); |
| 57 | 52 | } |
| 58 | 53 | |
| 59 | 54 | if (!defined('STAGS_VERSION')) { |
| 60 | -define('STAGS_VERSION', '3.6.0'); | |
| 55 | + define('STAGS_VERSION', '3.53.0'); | |
| 61 | 56 | } |
| 62 | 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 | + } | |
| 63 | 64 | |
| 64 | -$pro_active = false; | |
| 65 | + if (! function_exists('get_option')) { | |
| 66 | + return false; | |
| 67 | + } | |
| 65 | 68 | |
| 66 | -foreach ((array)get_option('active_plugins') as $plugin_file) { | |
| 67 | - if (false !== strpos($plugin_file, 'taxopress-pro.php')) { | |
| 68 | - $pro_active = true; | |
| 69 | - break; | |
| 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; | |
| 70 | 88 | } |
| 71 | 89 | } |
| 72 | 90 | |
| 73 | -if (!$pro_active && is_multisite()) { | |
| 74 | - foreach (array_keys((array)get_site_option('active_sitewide_plugins')) as $plugin_file) { | |
| 75 | - if (false !== strpos($plugin_file, 'taxopress-pro.php')) { | |
| 76 | - $pro_active = true; | |
| 77 | - break; | |
| 78 | - } | |
| 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 | + }); | |
| 79 | 128 | } |
| 129 | + | |
| 130 | + return; | |
| 80 | 131 | } |
| 81 | 132 | |
| 82 | -if ($pro_active) { | |
| 83 | - add_filter( | |
| 84 | - 'plugin_row_meta', | |
| 85 | - function($links, $file) | |
| 86 | - { | |
| 87 | - if ($file == plugin_basename(__FILE__)) { | |
| 88 | - $links[]= __('<strong>This plugin can be deleted.</strong>', 'simple-tags'); | |
| 89 | - } | |
| 133 | +$includeFileRelativePath = '/publishpress/instance-protection/include.php'; | |
| 90 | 134 | |
| 91 | - return $links; | |
| 92 | - }, | |
| 93 | - 10, 2 | |
| 94 | - ); | |
| 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; | |
| 95 | 139 | } |
| 96 | 140 | |
| 97 | -if (defined('TAXOPRESS_FILE') || $pro_active) { | |
| 98 | - if(!function_exists('deactivate_plugins')){ | |
| 99 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 100 | - } | |
| 101 | - //deactivate current plugin if pro is active | |
| 102 | - deactivate_plugins( plugin_basename( __FILE__ ) ); | |
| 103 | - return; | |
| 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); | |
| 104 | 147 | } |
| 105 | 148 | |
| 149 | +$bundledTranslationsPath = '/publishpress/bundled-translations/core/include.php'; | |
| 106 | 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 | +} | |
| 107 | 156 | |
| 108 | -define ( 'TAXOPRESS_FILE', __FILE__ ); | |
| 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 | +} | |
| 109 | 164 | |
| 110 | -define('STAGS_MIN_PHP_VERSION', '5.6'); | |
| 111 | -define('STAGS_OPTIONS_NAME', 'simpletags'); // Option name for save settings | |
| 112 | -define('STAGS_OPTIONS_NAME_AUTO', 'simpletags-auto'); // Option name for save settings auto terms | |
| 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); | |
| 113 | 175 | |
| 114 | -define('STAGS_URL', plugins_url('', __FILE__)); | |
| 115 | -define('STAGS_DIR', rtrim(plugin_dir_path(__FILE__), '/')); | |
| 116 | -define('TAXOPRESS_ABSPATH', __DIR__); | |
| 176 | +$wordpressVersionNoticesPath = '/publishpress/wordpress-version-notices/src/include.php'; | |
| 117 | 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 | + | |
| 118 | 217 | // Check PHP min version |
| 119 | 218 | if (version_compare(PHP_VERSION, STAGS_MIN_PHP_VERSION, '<')) { |
| 120 | 219 | require STAGS_DIR . '/inc/class.compatibility.php'; |
| 121 | 220 | |
| @@ -135,11 +234,11 @@ | ||
| 135 | 234 | require_once(TAXOPRESS_ABSPATH . '/includes-core/TaxopressCoreAdmin.php'); |
| 136 | 235 | new \PublishPress\Taxopress\TaxopressCoreAdmin(); |
| 137 | 236 | } |
| 138 | 237 | } |
| 139 | -add_action('plugins_loaded', 'init_free_simple_tags'); | |
| 238 | +add_action('init', 'init_free_simple_tags', 0); | |
| 140 | 239 | |
| 141 | 240 | // Activation, uninstall |
| 142 | 241 | register_activation_hook(__FILE__, array('SimpleTags_Plugin', 'activation')); |
| 143 | 242 | register_deactivation_hook(__FILE__, array('SimpleTags_Plugin', 'deactivation')); |
| 144 | 243 | |
| 145 | -add_action('plugins_loaded', 'init_simple_tags'); | |
| 244 | +add_action('init', 'init_simple_tags', 0); | |