| @@ -1,19 +1,30 @@ | ||
| 1 | 1 | <?php |
| 2 | -/* | |
| 3 | -Plugin Name: TaxoPress | |
| 4 | -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.4.4 | |
| 7 | -Requires PHP: 5.6 | |
| 8 | -Requires at least: 3.3 | |
| 9 | -Tested up to: 5.6 | |
| 10 | -Author: TaxoPress | |
| 11 | -Author URI: https://taxopress.com | |
| 12 | -Text Domain: simple-tags | |
| 13 | 2 | |
| 14 | -Copyright 2013-2021 TaxoPress | |
| 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 | + */ | |
| 15 | 24 | |
| 25 | +###################################### | |
| 26 | +/* | |
| 16 | 27 | This program is free software; you can redistribute it and/or modify |
| 17 | 28 | it under the terms of the GNU General Public License as published by |
| 18 | 29 | the Free Software Foundation; either version 2 of the License, or |
| 19 | 30 | (at your option) any later version. |
| @@ -31,8 +42,9 @@ | ||
| 31 | 42 | Sections of the TaxoPress code are based on Custom Post Type UI by WebDevStudios. |
| 32 | 43 | |
| 33 | 44 | Credits Icons : |
| 34 | 45 | - famfamfam - http://www.famfamfam.com/lab/icons/silk/ |
| 46 | + | |
| 35 | 47 | */ |
| 36 | 48 | |
| 37 | 49 | // don't load directly |
| 38 | 50 | if (!defined('ABSPATH')) { |
| @@ -39,61 +51,170 @@ | ||
| 39 | 51 | die('-1'); |
| 40 | 52 | } |
| 41 | 53 | |
| 42 | 54 | if (!defined('STAGS_VERSION')) { |
| 43 | -define('STAGS_VERSION', '3.4.4'); | |
| 55 | + define('STAGS_VERSION', '3.53.0'); | |
| 44 | 56 | } |
| 45 | 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 | + } | |
| 46 | 64 | |
| 47 | -$pro_active = false; | |
| 65 | + if (! function_exists('get_option')) { | |
| 66 | + return false; | |
| 67 | + } | |
| 48 | 68 | |
| 49 | -foreach ((array)get_option('active_plugins') as $plugin_file) { | |
| 50 | - if (false !== strpos($plugin_file, 'taxopress-pro.php')) { | |
| 51 | - $pro_active = true; | |
| 52 | - 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; | |
| 53 | 88 | } |
| 54 | 89 | } |
| 55 | 90 | |
| 56 | -if (!$pro_active && is_multisite()) { | |
| 57 | - foreach (array_keys((array)get_site_option('active_sitewide_plugins')) as $plugin_file) { | |
| 58 | - if (false !== strpos($plugin_file, 'taxopress-pro.php')) { | |
| 59 | - $pro_active = true; | |
| 60 | - break; | |
| 61 | - } | |
| 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 | + }); | |
| 62 | 128 | } |
| 129 | + | |
| 130 | + return; | |
| 63 | 131 | } |
| 64 | 132 | |
| 65 | -if ($pro_active) { | |
| 66 | - add_filter( | |
| 67 | - 'plugin_row_meta', | |
| 68 | - function($links, $file) | |
| 69 | - { | |
| 70 | - if ($file == plugin_basename(__FILE__)) { | |
| 71 | - $links[]= __('<strong>This plugin can be deleted.</strong>', 'simple-tags'); | |
| 72 | - } | |
| 133 | +$includeFileRelativePath = '/publishpress/instance-protection/include.php'; | |
| 73 | 134 | |
| 74 | - return $links; | |
| 75 | - }, | |
| 76 | - 10, 2 | |
| 77 | - ); | |
| 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; | |
| 78 | 139 | } |
| 79 | 140 | |
| 80 | -if (defined('TAXOPRESS_FILE') || $pro_active) { | |
| 81 | - 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); | |
| 82 | 147 | } |
| 83 | 148 | |
| 149 | +$bundledTranslationsPath = '/publishpress/bundled-translations/core/include.php'; | |
| 84 | 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 | +} | |
| 85 | 156 | |
| 86 | -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 | +} | |
| 87 | 164 | |
| 88 | -define('STAGS_MIN_PHP_VERSION', '5.6'); | |
| 89 | -define('STAGS_OPTIONS_NAME', 'simpletags'); // Option name for save settings | |
| 90 | -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); | |
| 91 | 175 | |
| 92 | -define('STAGS_URL', plugins_url('', __FILE__)); | |
| 93 | -define('STAGS_DIR', rtrim(plugin_dir_path(__FILE__), '/')); | |
| 94 | -define('TAXOPRESS_ABSPATH', __DIR__); | |
| 176 | +$wordpressVersionNoticesPath = '/publishpress/wordpress-version-notices/src/include.php'; | |
| 95 | 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 | + | |
| 96 | 217 | // Check PHP min version |
| 97 | 218 | if (version_compare(PHP_VERSION, STAGS_MIN_PHP_VERSION, '<')) { |
| 98 | 219 | require STAGS_DIR . '/inc/class.compatibility.php'; |
| 99 | 220 | |
| @@ -113,11 +234,11 @@ | ||
| 113 | 234 | require_once(TAXOPRESS_ABSPATH . '/includes-core/TaxopressCoreAdmin.php'); |
| 114 | 235 | new \PublishPress\Taxopress\TaxopressCoreAdmin(); |
| 115 | 236 | } |
| 116 | 237 | } |
| 117 | -add_action('plugins_loaded', 'init_free_simple_tags'); | |
| 238 | +add_action('init', 'init_free_simple_tags', 0); | |
| 118 | 239 | |
| 119 | 240 | // Activation, uninstall |
| 120 | 241 | register_activation_hook(__FILE__, array('SimpleTags_Plugin', 'activation')); |
| 121 | 242 | register_deactivation_hook(__FILE__, array('SimpleTags_Plugin', 'deactivation')); |
| 122 | 243 | |
| 123 | -add_action('plugins_loaded', 'init_simple_tags'); | |
| 244 | +add_action('init', 'init_simple_tags', 0); | |