PluginProbe
Tag Groups is the Advanced Way to Display Your Taxonomy Terms / 2.2.2
Tag Groups is the Advanced Way to Display Your Taxonomy Terms v2.2.2
2.2.2 2.2.1 2.2.0 trunk 1.40.0 1.40.2 1.41.0 1.42.1 1.43.0 1.43.1 1.43.10 1.43.10.1 1.43.2 1.43.3 1.43.4 1.43.5 1.43.6 1.43.7 1.43.9 1.44.0 1.44.1 1.44.3 1.44.3.1 2.0.0 2.0.1 All 36 releases
tag-groups / tag-groups.php

tag-groups.php in Tag Groups is the Advanced Way to Display Your Taxonomy Terms 2.2.2, at tag-groups.php

219 lines 8.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: Tag Groups
5 * Plugin URI: https://wordpress.org/plugins/tag-groups/
6 * Description: Tag Groups allows you to organize your WordPress taxonomy terms and show them in clouds, tabs, accordions, tables, lists and much more.
7 * Author: TaxoPress
8 * Author URI: https://taxopress.com
9 * Version: 2.2.2
10 * License: GPL-3.0-or-later
11 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
12 * Text Domain: tag-groups
13 * Domain Path: /languages
14 * Requires at least: 5.5
15 * Requires PHP: 7.2.5
16 *
17 * @package TaxoPress\TagGroups
18 * @author TaxoPress
19 * @copyright Copyright (c) 2024, TaxoPress
20 * @license GPL-3.0-or-later
21 */
22
23 // keep the following line for automatic processing
24 // define( "CM_TGP_KERNL_UUID", '' );
25
26 defined('ABSPATH') || exit;
27 $includeFileRelativePath = '/publishpress/instance-protection/include.php';
28 if (file_exists(__DIR__ . '/lib/vendor' . $includeFileRelativePath)) {
29 require_once __DIR__ . '/lib/vendor' . $includeFileRelativePath;
30 } elseif (file_exists(__DIR__ . '/vendor' . $includeFileRelativePath)) {
31 require_once __DIR__ . '/vendor' . $includeFileRelativePath;
32 }
33
34 if (class_exists('PublishPressInstanceProtection\Config')) {
35 $pluginCheckerConfig = new PublishPressInstanceProtection\Config();
36 $pluginCheckerConfig->pluginSlug = 'tag-groups';
37 $pluginCheckerConfig->pluginName = 'Tag Groups';
38 $pluginChecker = new PublishPressInstanceProtection\InstanceChecker($pluginCheckerConfig);
39 }
40
41 $bundledTranslationsPath = '/publishpress/bundled-translations/core/include.php';
42 if (file_exists(__DIR__ . '/lib/vendor' . $bundledTranslationsPath)) {
43 require_once __DIR__ . '/lib/vendor' . $bundledTranslationsPath;
44 } elseif (file_exists(__DIR__ . '/vendor' . $bundledTranslationsPath)) {
45 require_once __DIR__ . '/vendor' . $bundledTranslationsPath;
46 }
47
48 add_action('plugins_loaded', function () {
49
50 if (class_exists('PublishPress\BundledTranslations\BundledTranslations')) {
51 $bundledTranslations = new PublishPress\BundledTranslations\BundledTranslations('tag-groups', __DIR__ . '/languages', __FILE__);
52 $bundledTranslations->init();
53 }
54 }, 5);
55 $wordpressVersionNoticesPath = '/publishpress/wordpress-version-notices/src/include.php';
56 if (file_exists(__DIR__ . '/lib/vendor' . $wordpressVersionNoticesPath)) {
57 require_once __DIR__ . '/lib/vendor' . $wordpressVersionNoticesPath;
58 } elseif (file_exists(__DIR__ . '/vendor' . $wordpressVersionNoticesPath)) {
59 require_once __DIR__ . '/vendor' . $wordpressVersionNoticesPath;
60 }
61
62 if (!defined('TAG_GROUPS_PLUGIN_IS_FREE')) {
63 if (plugin_basename(__FILE__) == 'tag-groups/tag-groups.php') {
64 define('TAG_GROUPS_PLUGIN_IS_FREE', true);
65 } else {
66 // Don't define the constant! If the premium plugin runs earlier, the free plugin still needs to define it.
67 }
68 }
69 if (!defined('TAG_GROUPS_PLUGIN_IS_KERNL')) {
70 if (defined('CM_TGP_KERNL_UUID') && CM_TGP_KERNL_UUID != '' || defined('CM_TGP_BETA_PLUGIN_UUID') && CM_TGP_BETA_PLUGIN_UUID != '') {
71 define('TAG_GROUPS_PLUGIN_IS_KERNL', true);
72 } else {
73 define('TAG_GROUPS_PLUGIN_IS_KERNL', false);
74 }
75 }
76
77 if (!defined('TAG_GROUPS_PLUGIN_BASENAME')) {
78 define('TAG_GROUPS_FILE', __FILE__);
79 /**
80 * The plugin's relative path (starting below the plugin directory), including the name of this file.
81 */
82 define("TAG_GROUPS_PLUGIN_BASENAME", plugin_basename(__FILE__));
83 /**
84 * The required minimum version of WordPress.
85 */
86 define("TAG_GROUPS_MINIMUM_VERSION_WP", "4.9");
87 /**
88 * Comma-separated list of default themes that come bundled with this plugin.
89 */
90 define("TAG_GROUPS_BUILT_IN_THEMES", "delta,base,ui-gray,ui-lightness,ui-darkness,blitzer,aristo");
91 /**
92 * The theme that is selected by default. Must be among TAG_GROUPS_BUILT_IN_THEMES.
93 */
94 define("TAG_GROUPS_STANDARD_THEME", "delta");
95 /**
96 * The default number of groups on one page on the edit group screen.
97 */
98 define("TAG_GROUPS_ITEMS_PER_PAGE", 20);
99 /**
100 * This plugin's last piece of the path, i.e. basically the plugin's name
101 */
102 define("TAG_GROUPS_PLUGIN_RELATIVE_PATH", basename(dirname(__FILE__)));
103 /**
104 * This plugin's absolute path on this server - starting from root.
105 */
106 define("TAG_GROUPS_PLUGIN_ABSOLUTE_PATH", dirname(__FILE__));
107 if (!defined('TAG_GROUPS_LIB_VENDOR_PATH')) {
108 define('TAG_GROUPS_LIB_VENDOR_PATH', __DIR__ . '/lib/vendor');
109 }
110 }
111
112 if (defined('TAG_GROUPS_LOADED_BY_PRO') && TAG_GROUPS_LOADED_BY_PRO && defined('TAG_GROUPS_PRO_ABSPATH')) {
113 if (!defined('TAG_GROUPS_PREMIUM_PLUGIN_ABSOLUTE_PATH')) {
114 define('TAG_GROUPS_PREMIUM_PLUGIN_ABSOLUTE_PATH', TAG_GROUPS_PRO_ABSPATH . '/premium');
115 }
116 if (!defined('TAG_GROUPS_PREMIUM_PLUGIN_RELATIVE_PATH')) {
117 define('TAG_GROUPS_PREMIUM_PLUGIN_RELATIVE_PATH', 'premium');
118 }
119 if (!defined('TAG_GROUPS_PREMIUM_CACHE_LIFETIME')) {
120 define('TAG_GROUPS_PREMIUM_CACHE_LIFETIME', 600);
121 }
122 if (!defined('TAG_GROUPS_PREMIUM_MB_RELOAD_TAGS')) {
123 define('TAG_GROUPS_PREMIUM_MB_RELOAD_TAGS', 300000);
124 }
125 if (!defined('TAG_GROUPS_PREMIUM_PLUGIN_URL') && defined('TAG_GROUPS_PRO_URL')) {
126 define('TAG_GROUPS_PREMIUM_PLUGIN_URL', TAG_GROUPS_PRO_URL . '/premium');
127 }
128 }
129
130 $libAutoloadPath = TAG_GROUPS_LIB_VENDOR_PATH . '/autoload.php';
131 if (file_exists($libAutoloadPath)) {
132 require_once $libAutoloadPath;
133 }
134
135 $autoloadPath = TAG_GROUPS_PLUGIN_ABSOLUTE_PATH . '/vendor/autoload.php';
136 if (file_exists($autoloadPath)) {
137 require_once $autoloadPath;
138 }
139
140 /**
141 * Make scope of $tag_groups_loader global for wp-cli
142 */
143 global $tag_groups_loader ;
144 require_once dirname(__FILE__) . '/include/class.loader.php';
145 $tag_groups_loader = new TagGroups_Loader(TAG_GROUPS_PLUGIN_ABSOLUTE_PATH);
146 $tag_groups_loader->require_classes();
147 if (!function_exists('tag_groups_init')) {
148 /**
149 * Do all initial stuff: register hooks, check dependencies
150 *
151 *
152 * @param void
153 * @return void
154 */
155 function tag_groups_init()
156 {
157 global $tag_groups_loader ;
158 if (plugin_basename(__FILE__) != 'tag-groups/tag-groups.php') {
159 /**
160 * TGP-Codester or TGP-Freemius
161 */
162
163 if (defined('TAG_GROUPS_PLUGIN_IS_FREE') && TAG_GROUPS_PLUGIN_IS_FREE) {
164 /**
165 * The free version is also active.
166 */
167 /**
168 * Make sure we don't delete data by removing the base plugin by returning data removal to opt-in:
169 * Set the option to OFF and keep, because removing the plugin might only happen later.
170 */
171 update_option('tag_group_reset_when_uninstall', 0);
172 require_once ABSPATH . 'wp-admin/includes/plugin.php';
173 deactivate_plugins('tag-groups/tag-groups.php', true);
174 // add the hook directly
175 add_action('admin_notices', function () {
176
177 echo '<div class="notice notice-info is-dismissible"><p>' . esc_html__('The free Tag Groups plugin cannot be active together with Tag Groups Pro.', 'tag-groups') . ' <a href="https://taxopress.com/docs/tag-groups/" target="_blank" style="text-decoration: none;" title="' . esc_attr__('more information', 'tag-groups') . '"><span class="dashicons dashicons-editor-help"></span></a></p></div><div clear="all" /></div>' ;
178 });
179 /**
180 * Remove the misleading "Plugin activated" messaage
181 */
182 unset($_GET['activate']);
183 }
184 }
185 // URL must be defined after WP has finished loading its settings
186
187 if (!defined('TAG_GROUPS_PLUGIN_URL')) {
188 define("TAG_GROUPS_PLUGIN_URL", plugins_url('', __FILE__));
189 // start all initializations, registration of hooks, housekeeping, menus, ...
190 $tag_groups_loader->set_version();
191 $tag_groups_loader->check_preconditions();
192 $tag_groups_loader->provide_globals();
193 $tag_groups_loader->add_hooks();
194 $tag_groups_loader->register_shortcodes_and_blocks();
195 $tag_groups_loader->register_REST_API();
196 $tag_groups_loader->register_CRON();
197 if (is_admin()) {
198 // Only load free-only admin features if not running inside Pro
199 if (!defined('TAG_GROUPS_SKIP_VERSION_NOTICES') || !TAG_GROUPS_SKIP_VERSION_NOTICES) {
200 require_once(TAG_GROUPS_PLUGIN_ABSOLUTE_PATH . '/includes-core/TagGroupsCoreAdmin.php');
201 new \TaxoPress\TagGroups\TagGroupsCoreAdmin();
202 require_once(TAG_GROUPS_PLUGIN_ABSOLUTE_PATH . '/includes-core/TagGroupsReviews.php');
203 }
204 }
205 }
206 }
207
208 add_action('plugins_loaded', 'tag_groups_init');
209 register_activation_hook(__FILE__, array( 'TagGroups_Activation_Deactivation', 'on_activation' ));
210 }
211
212 /**
213 * aliases for common functions, for backwards compatibility
214 */
215 require_once 'aliases.php';
216 /**
217 * guess what - the end
218 */
219