PluginProbe
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms / trunk
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms vtrunk
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 3.6.1 3.6.2 All 177 releases
simple-tags / simple-tags.php

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

245 lines 7.8 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: 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);
245