PluginProbe
PublishPress Taxonomies – Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms / 4.0.0
PublishPress Taxonomies – Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms v4.0.0
4.0.0 3.54.0 3.53.0 3.52.0 3.51.0 3.50.0 3.45.0 3.38.0 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.40.0 3.40.1 3.41.0 3.42.0 3.43.0 3.44.0 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 All 179 releases
simple-tags / simple-tags.php

simple-tags.php in PublishPress Taxonomies – Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms 4.0.0, at simple-tags.php

269 lines 9.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: PublishPress Taxonomies Free
5 * Plugin URI: https://wordpress.org/plugins/simple-tags/
6 * Description: PublishPress Taxonomies allows you to create and manage Tags, Categories, and all your WordPress taxonomy terms.
7 * Version: 4.0.0
8 * Author: PublishPress
9 * Author URI: https://publishpress.com
10 * Text Domain: simple-tags
11 * Domain Path: /languages
12 * Requires at least: 6.7
13 * Requires PHP: 7.4
14 * License: GPLv3
15 *
16 * Copyright (c) 2022 PublishPress
17 *
18 * @package simple-tags
19 * @author PublishPress
20 * @copyright Copyright (c) 2022 PublishPress
21 * @license GNU General Public License version 2
22 * @link https://publishpress.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 PublishPress Taxonomies code include:
38 - Kevin Drouvin ([email protected] - http://inside-dev.net)
39 - Martin Modler ([email protected] - http://www.webformatik.com)
40 - Vladimir Kolesnikov ([email protected] - http://blog.sjinks.pro)
41
42 Sections of the PublishPress Taxonomies 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', '4.0.0');
56 }
57
58 if (! defined('PUBLISHPRESS_TAXONOMIES_VERSION')) {
59 define('PUBLISHPRESS_TAXONOMIES_VERSION', STAGS_VERSION);
60 }
61
62 // Preserve the legacy TaxoPress version alias for existing integrations.
63 if (! defined('TAXOPRESS_VERSION')) {
64 define('TAXOPRESS_VERSION', PUBLISHPRESS_TAXONOMIES_VERSION);
65 }
66
67 if (! function_exists('taxopress_free_is_pro_active')) {
68 function taxopress_free_is_pro_active()
69 {
70 // Recognize PublishPress Taxonomies Pro and legacy TaxoPress Pro identifiers.
71 if (
72 defined('PUBLISHPRESS_TAXONOMIES_PRO_FILE')
73 || defined('PUBLISHPRESS_TAXONOMIES_PRO_VERSION')
74 || defined('TAXOPRESS_PRO_FILE')
75 || defined('TAXOPRESS_PRO_VERSION')
76 ) {
77 return true;
78 }
79
80 if (! function_exists('get_option')) {
81 return false;
82 }
83
84 $pro_active = false;
85
86 foreach ((array) get_option('active_plugins') as $plugin_file) {
87 // Support the legacy entry point and both renamed-plugin transition paths.
88 if (
89 false !== strpos($plugin_file, 'taxopress-pro/taxopress-pro.php')
90 || false !== strpos($plugin_file, 'publishpress-taxonomies-pro/taxopress-pro.php')
91 || false !== strpos($plugin_file, 'publishpress-taxonomies-pro/publishpress-taxonomies-pro.php')
92 ) {
93 $pro_active = true;
94 break;
95 }
96 }
97
98 if (! $pro_active && function_exists('is_multisite') && is_multisite()) {
99 foreach (array_keys((array) get_site_option('active_sitewide_plugins')) as $plugin_file) {
100 if (
101 false !== strpos($plugin_file, 'taxopress-pro/taxopress-pro.php')
102 || false !== strpos($plugin_file, 'publishpress-taxonomies-pro/taxopress-pro.php')
103 || false !== strpos($plugin_file, 'publishpress-taxonomies-pro/publishpress-taxonomies-pro.php')
104 ) {
105 $pro_active = true;
106 break;
107 }
108 }
109 }
110
111 return $pro_active;
112 }
113 }
114
115 if (taxopress_free_is_pro_active()) {
116 if (is_admin()) {
117 add_filter(
118 'plugin_row_meta',
119 function ($links, $file) {
120 if ($file === plugin_basename(__FILE__)) {
121 $links[] = '<strong>' . esc_html__('This plugin can be deleted.', 'simple-tags') . '</strong>';
122 }
123
124 return $links;
125 },
126 10,
127 2
128 );
129
130 add_action('admin_init', function () {
131 if (! function_exists('deactivate_plugins')) {
132 require_once ABSPATH . 'wp-admin/includes/plugin.php';
133 }
134
135 if (function_exists('is_plugin_active') && is_plugin_active(plugin_basename(__FILE__))) {
136 deactivate_plugins(plugin_basename(__FILE__));
137 set_transient('taxopress_free_deactivated_due_to_pro', 1, 30);
138 }
139 });
140
141 add_action('admin_notices', function () {
142 if (! get_transient('taxopress_free_deactivated_due_to_pro')) {
143 return;
144 }
145
146 delete_transient('taxopress_free_deactivated_due_to_pro');
147
148 echo '<div class="notice notice-warning is-dismissible"><p>'
149 . esc_html__('PublishPress Taxonomies was not activated because PublishPress Taxonomies Pro is already active. Please keep only PublishPress Taxonomies Pro enabled.', 'simple-tags')
150 . '</p></div>';
151 });
152 }
153
154 return;
155 }
156
157 $includeFileRelativePath = '/publishpress/instance-protection/include.php';
158
159 if (file_exists(__DIR__ . '/lib/vendor' . $includeFileRelativePath)) {
160 require_once __DIR__ . '/lib/vendor' . $includeFileRelativePath;
161 } elseif (defined('STAGS_LIB_VENDOR_PATH') && file_exists(STAGS_LIB_VENDOR_PATH . $includeFileRelativePath)) {
162 require_once STAGS_LIB_VENDOR_PATH . $includeFileRelativePath;
163 }
164
165 if (class_exists('PublishPressInstanceProtection\\Config')) {
166 $pluginCheckerConfig = new PublishPressInstanceProtection\Config();
167 $pluginCheckerConfig->pluginSlug = 'simple-tags';
168 $pluginCheckerConfig->pluginName = 'PublishPress Taxonomies';
169
170 $pluginChecker = new PublishPressInstanceProtection\InstanceChecker($pluginCheckerConfig);
171 }
172
173 $bundledTranslationsPath = '/publishpress/bundled-translations/core/include.php';
174
175 if (file_exists(__DIR__ . '/lib/vendor' . $bundledTranslationsPath)) {
176 require_once __DIR__ . '/lib/vendor' . $bundledTranslationsPath;
177 } elseif (defined('STAGS_LIB_VENDOR_PATH') && file_exists(STAGS_LIB_VENDOR_PATH . $bundledTranslationsPath)) {
178 require_once STAGS_LIB_VENDOR_PATH . $bundledTranslationsPath;
179 }
180
181 $autoloadPath = __DIR__ . '/lib/vendor/autoload.php';
182 if (!file_exists($autoloadPath)) {
183 $autoloadPath = __DIR__ . '/vendor/autoload.php';
184 }
185 if (file_exists($autoloadPath)) {
186 require_once $autoloadPath;
187 }
188
189 add_action('plugins_loaded', function () {
190 if (class_exists('PublishPress\BundledTranslations\BundledTranslations')) {
191 $bundledTranslations = new PublishPress\BundledTranslations\BundledTranslations(
192 'simple-tags',
193 __DIR__ . '/languages',
194 __FILE__
195 );
196 $bundledTranslations->init();
197 }
198 }, 10);
199
200 $wordpressVersionNoticesPath = '/publishpress/wordpress-version-notices/src/include.php';
201
202 if (file_exists(__DIR__ . '/lib/vendor' . $wordpressVersionNoticesPath)) {
203 require_once __DIR__ . '/lib/vendor' . $wordpressVersionNoticesPath;
204 } elseif (defined('STAGS_LIB_VENDOR_PATH') && file_exists(STAGS_LIB_VENDOR_PATH . $wordpressVersionNoticesPath)) {
205 require_once STAGS_LIB_VENDOR_PATH . $wordpressVersionNoticesPath;
206 }
207
208
209 if (! defined('TAXOPRESS_FILE')) {
210 define('TAXOPRESS_FILE', __FILE__);
211 }
212
213 if (! defined('STAGS_MIN_PHP_VERSION')) {
214 define('STAGS_MIN_PHP_VERSION', '7.4');
215 }
216
217 if (! defined('STAGS_OPTIONS_NAME')) {
218 define('STAGS_OPTIONS_NAME', 'simpletags'); // Option name for save settings
219 }
220
221 if (! defined('STAGS_OPTIONS_NAME_AUTO')) {
222 define('STAGS_OPTIONS_NAME_AUTO', 'simpletags-auto'); // Option name for save settings auto terms
223 }
224
225 if (! defined('STAGS_URL')) {
226 define('STAGS_URL', plugins_url('', __FILE__));
227 }
228
229 if (! defined('STAGS_DIR')) {
230 define('STAGS_DIR', rtrim(plugin_dir_path(__FILE__), '/'));
231 }
232
233 if (! defined('TAXOPRESS_ABSPATH')) {
234 define('TAXOPRESS_ABSPATH', __DIR__);
235 }
236
237 if (! defined('STAGS_LIB_VENDOR_PATH')) {
238 define('STAGS_LIB_VENDOR_PATH', __DIR__ . '/lib/vendor');
239 }
240
241 // Check PHP min version
242 if (version_compare(PHP_VERSION, STAGS_MIN_PHP_VERSION, '<')) {
243 require STAGS_DIR . '/inc/class.compatibility.php';
244
245 // possibly display a notice, trigger error
246 add_action('admin_init', array('SimpleTags_Compatibility', 'admin_init'));
247
248 // stop execution of this file
249 return;
250 }
251
252 require STAGS_DIR . '/inc/loads.php';
253
254 // Init PublishPress Taxonomies
255 function init_free_simple_tags()
256 {
257 if (is_admin() && ! defined('PUBLISHPRESS_TAXONOMIES_PRO_VERSION') && ! defined('TAXOPRESS_PRO_VERSION')) {
258 require_once(TAXOPRESS_ABSPATH . '/includes-core/TaxopressCoreAdmin.php');
259 new \PublishPress\Taxopress\TaxopressCoreAdmin();
260 }
261 }
262 add_action('init', 'init_free_simple_tags', 0);
263
264 // Activation, uninstall
265 register_activation_hook(__FILE__, array('SimpleTags_Plugin', 'activation'));
266 register_deactivation_hook(__FILE__, array('SimpleTags_Plugin', 'deactivation'));
267
268 add_action('init', 'init_simple_tags', 0);
269