PluginProbe
WPGlobus / 3.0.5
WPGlobus v3.0.5
3.0.5 3.0.4 trunk 2.1.15 2.10.10 2.12.2 2.2.35 2.3.12 2.4.17 2.5.23 2.6.8 2.7.14 2.8.11 3.0.0 3.0.1 3.0.2 3.0.3
wpglobus / wpglobus.php

wpglobus.php in WPGlobus 3.0.5, at wpglobus.php

300 lines 7.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: WPGlobus
4 * Version: 3.0.5
5 * Plugin URI: https://wordpress.org/plugins/wpglobus/
6 * Description: A WordPress Globalization / Multilingual Plugin. Posts, pages, menus, widgets and even custom fields - in multiple languages!
7 * Author: TIV.NET INC
8 * Author URI: https://woocommerce.com/vendor/tiv-net-inc/
9 * Developer: TIV.NET
10 * Developer URI: https://tivnet.com/
11 * Text Domain: wpglobus
12 * Domain Path: /languages/
13 * Requires at least: 6.9
14 * Tested up to: 7.0.4
15 * Requires PHP: 7.4
16 *
17 * Copyright: © TIV.NET INC.
18 * License: GPL-3.0-or-later
19 * License URI: https://spdx.org/licenses/GPL-3.0-or-later.html
20 */
21
22 if ( ! defined( 'ABSPATH' ) ) {
23 exit; // Exit if accessed directly
24 }
25
26 if ( ! is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
27 return;
28 }
29 require_once __DIR__ . '/vendor/autoload.php';
30
31 /**
32 * (Disabled) Stand down in favor of TIV Globus.
33 *
34 * WPGlobus and TIV Globus hook the same multilingual surfaces and must never run
35 * at the same time. That mutual exclusion is enforced on the TIV Globus side - its
36 * LegacyGuard goes dormant when WPGlobus is active - so WPGlobus itself does NOT
37 * stand down: it always runs, and TIV Globus steps aside.
38 *
39 * This block implements the reverse policy (WPGlobus standing down instead). It is
40 * kept but intentionally disabled via the "0 &&" guard, so it can be re-enabled if
41 * that decision is ever revisited. Both plugins share the same stored data, so
42 * translations are preserved whichever one stands down.
43 *
44 * @since 3.0.3
45 */
46 if ( 0 && defined( 'TIV_GLOBUS_VERSION' ) ) {
47
48 add_action( 'admin_notices', function () {
49 if ( ! current_user_can( 'activate_plugins' ) ) {
50 return;
51 }
52
53 $plugin = plugin_basename( __FILE__ );
54 $deactivate_url = wp_nonce_url(
55 self_admin_url( 'plugins.php?action=deactivate&plugin=' . rawurlencode( $plugin ) . '&plugin_status=all' ),
56 'deactivate-plugin_' . $plugin
57 );
58 ?>
59 <div class="notice notice-error">
60 <p>
61 <strong>WPGlobus is inactive.</strong>
62 TIV Globus - its successor - is active and is handling all multilingual features.
63 Running both at once is not supported, so WPGlobus is standing down.
64 </p>
65 <p>
66 <a href="<?php echo esc_url( $deactivate_url ); ?>">Deactivate WPGlobus</a>
67 to remove this notice.
68 </p>
69 </div>
70 <?php
71 } );
72
73 return;
74 }
75
76 define( 'WPGLOBUS_VERSION', '3.0.5' );
77 define( 'WPGLOBUS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
78 define( 'WPGLOBUS_AJAX', 'wpglobus-ajax' );
79
80 /*
81 * @todo Get rid of these
82 */
83 // @codingStandardsIgnoreStart
84 global $WPGlobus;
85 global $WPGlobus_Options;
86 // @codingStandardsIgnoreEnd
87
88 /**
89 * Compatibility functions.
90 *
91 * @since 1.6.4
92 */
93 require_once dirname( __FILE__ ) . '/includes/compat/mbstring.php';
94
95 /**
96 * Abstract class for plugins.
97 *
98 * @since 1.6.1
99 */
100 require_once dirname( __FILE__ ) . '/includes/class-wpglobus-plugin.php';
101
102 require_once dirname( __FILE__ ) . '/includes/class-wpglobus-config.php';
103 require_once dirname( __FILE__ ) . '/includes/class-wpglobus-utils.php';
104 require_once dirname( __FILE__ ) . '/includes/class-wpglobus-wp.php';
105 require_once dirname( __FILE__ ) . '/includes/class-wpglobus-widget.php';
106 require_once dirname( __FILE__ ) . '/includes/class-wpglobus.php';
107
108 require_once dirname( __FILE__ ) . '/includes/class-wpglobus-core.php';
109
110 require_once dirname( __FILE__ ) . '/includes/class-wpglobus-rest-api.php';
111
112 /**
113 * Admin page helpers.
114 *
115 * @since 1.6.5
116 */
117 require_once dirname( __FILE__ ) . '/includes/admin/class-wpglobus-admin-page.php';
118
119 /**
120 * Initialize
121 *
122 * @todo Rename uppercase variables.
123 */
124 // @codingStandardsIgnoreStart
125 WPGlobus::$PLUGIN_DIR_PATH = plugin_dir_path( __FILE__ );
126 WPGlobus::$PLUGIN_DIR_URL = plugin_dir_url( __FILE__ );
127 // @codingStandardsIgnoreEnd
128 WPGlobus::Config();
129
130 require_once dirname( __FILE__ ) . '/includes/class-wpglobus-filters.php';
131 require_once dirname( __FILE__ ) . '/includes/wpglobus-controller.php';
132
133 WPGlobus_Rest_API::construct();
134
135 /**
136 * Support for Yoast SEO
137 *
138 * @since 3.0.0 Old versions not supported anymore. Using the current `$ver`.
139 */
140 add_action( 'plugins_loaded', function () {
141
142 if ( defined( 'WPSEO_PREMIUM_VERSION' ) ) {
143 $ver = WPSEO_PREMIUM_VERSION;
144 } elseif ( defined( 'WPSEO_VERSION' ) ) {
145 $ver = WPSEO_VERSION;
146 } else {
147 return;
148 }
149
150 /**
151 * Plus
152 *
153 * @since 2.2.20
154 */
155 $wpglobus_yoastseo_plus_access = apply_filters( 'wpglobus_yoastseo_plus_access', false );
156
157 require_once __DIR__ . '/includes/vendor/yoast-seo/class-wpglobus-yoastseo.php';
158 WPGlobus_YoastSEO::controller( $ver, $wpglobus_yoastseo_plus_access );
159 } );
160
161 /**
162 * Support of theme option panels and customizer
163 *
164 * @since 1.4.0
165 */
166 require_once dirname( __FILE__ ) . '/includes/admin/customize/wpglobus-customize.php';
167
168 /**
169 * To disable WPGlobus Customizer Options, put this to wp-config:
170 * define( 'WPGLOBUS_CUSTOMIZE', false )
171 *
172 * @since 1.8.6
173 */
174 if ( ! defined( 'WPGLOBUS_CUSTOMIZE' ) || WPGLOBUS_CUSTOMIZE ) {
175 /**
176 * WPGlobus customize options
177 *
178 * @since 1.4.6
179 */
180 require_once dirname( __FILE__ ) . '/includes/admin/class-wpglobus-customize-options.php';
181 WPGlobus_Customize_Options::controller();
182 }
183
184 /**
185 * TIVWP Updater.
186 *
187 * @since 1.5.9
188 */
189 if (
190 version_compare( PHP_VERSION, '5.3.0', '>=' )
191 && file_exists( dirname( __FILE__ ) . '/vendor/tivwp/updater/updater.php' )
192 ) {
193 require_once dirname( __FILE__ ) . '/vendor/tivwp/updater/updater.php';
194 }
195
196 /**
197 * WPGlobus Post Types
198 *
199 * @since 1.9.10
200 */
201 require_once dirname( __FILE__ ) . '/includes/class-wpglobus-post-types.php';
202
203 /**
204 * WPGlobus Widgets.
205 *
206 * @since 2.8.6
207 */
208 if ( WPGlobus::Config()->use_widgets_block_editor ) {
209 require_once dirname( __FILE__ ) . '/includes/widgets/class-wpglobus-widgets.php';
210 WPGlobus_Widgets::get_instance( __FILE__ );
211 }
212
213 /**
214 * In admin area
215 */
216 if ( WPGlobus_WP::in_wp_admin() ) :
217
218 /**
219 * HelpDesk
220 *
221 * @since 1.6.5
222 */
223 require_once dirname( __FILE__ ) . '/includes/admin/helpdesk/class-wpglobus-admin-helpdesk.php';
224 WPGlobus_Admin_HelpDesk::construct();
225
226 /**
227 * WPGlobus Admin.
228 *
229 * @since 1.8.1
230 */
231 require_once dirname( __FILE__ ) . '/includes/admin/wpglobus-admin.php';
232
233 /**
234 * WPGlobus News admin dashboard widget.
235 *
236 * @since 1.7.7
237 * @since 3.0.0 Removed.
238 * require_once dirname( __FILE__ ) . '/includes/admin/class-wpglobus-dashboard-news.php';
239 * new WPGlobus_Dashboard_News();
240 */
241
242 /**
243 * WPGlobus addons.
244 *
245 * @since 1.7.8
246 * @since 3.0.0 Removed.
247 * // require_once dirname( __FILE__ ) . '/includes/admin/class-wpglobus-admin-menu.php';
248 * // WPGlobus_Admin_Menu::construct();
249 */
250
251 /**
252 * WPGlobus Recommendations.
253 * To disable recommendations, put this to wp-config:
254 * define( 'WPGLOBUS_RECOMMENDATIONS', false );
255 *
256 * @since 1.8.7
257 */
258 if ( ! defined( 'WPGLOBUS_RECOMMENDATIONS' ) || WPGLOBUS_RECOMMENDATIONS ) {
259 require_once dirname( __FILE__ ) . '/includes/admin/recommendations/class-wpglobus-admin-recommendations.php';
260 WPGlobus_Admin_Recommendations::setup_hooks();
261 }
262
263 /**
264 * WPGlobus with Gutenberg widgets block editor.
265 * To disable, put this to wp-config:
266 * define( 'WPGLOBUS_GUTENBERG_WIDGETS_BLOCK_EDITOR', false );
267 *
268 * @since 2.7.2
269 * @deprecated 2.8.0
270 * <code>
271 * // if ( ! defined('WPGLOBUS_GUTENBERG_WIDGETS_BLOCK_EDITOR') || WPGLOBUS_GUTENBERG_WIDGETS_BLOCK_EDITOR ) {
272 * // if ( defined('GUTENBERG_VERSION') ) {
273 * // require_once dirname( __FILE__ ) . '/includes/admin/gutenberg/class-wpglobus-admin-gutenberg.php';
274 * // WPGlobus_Admin_Gutenberg::construct();
275 * // }
276 * // }
277 * </code>
278 */
279
280 endif;
281
282 /**
283 * At the front
284 */
285 if ( ! is_admin() && ! WPGlobus_WP::is_doing_ajax() ) :
286
287 /**
288 * First-time automatic redirect to the primary language specified in the browser.
289 *
290 * @since 1.8.0
291 */
292
293 /* @noinspection NestedPositiveIfStatementsInspection */
294 if ( isset( WPGlobus::Config()->browser_redirect['redirect_by_language'] ) && WPGlobus::Config()->browser_redirect['redirect_by_language'] ) {
295 require_once dirname( __FILE__ ) . '/includes/class-wpglobus-redirect.php';
296 WPGlobus_Redirect::construct();
297 }
298
299 endif;
300