/
wpglobus.php
259 lines (227 loc) · 6.99 KB
/
wpglobus.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<?php
/**
* File: wpglobus.php
*
* @package WPGlobus
* Author TIV.NET INC, Alex Gor (alexgff) and Gregory Karpinsky (tivnet)
* Copyright 2015-2023 TIV.NET INC. / WPGlobus
* License http://www.gnu.org/licenses/gpl.txt GNU General Public License, version 3
*/
// <editor-fold desc="WordPress plugin header">
/**
* Plugin Name: WPGlobus
* Plugin URI: https://github.com/WPGlobus/WPGlobus
* Description: A WordPress Globalization / Multilingual Plugin. Posts, pages, menus, widgets and even custom fields - in multiple languages!
* Text Domain: wpglobus
* Domain Path: /languages/
* Version: 2.12.2
* Author: WPGlobus
* Author URI: https://wpglobus.com/
* Network: false
* Requires at least: 5.5
* Requires PHP: 5.6
* License: GPL-3.0-or-later
* License URI: https://spdx.org/licenses/GPL-3.0-or-later.html
*/
// </editor-fold>
// <editor-fold desc="GNU Clause">
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 3, as
* published by the Free Software Foundation.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// </editor-fold>
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'WPGLOBUS_VERSION', '2.12.2' );
define( 'WPGLOBUS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
define( 'WPGLOBUS_AJAX', 'wpglobus-ajax' );
/**
* WP Requirements library.
*
* @since 1.6.4
*/
if ( is_readable( dirname( __FILE__ ) . '/vendor/bemailr/wp-requirements/wpr-loader.php' ) ) {
require_once dirname( __FILE__ ) . '/vendor/bemailr/wp-requirements/wpr-loader.php';
}
/*
* @todo Get rid of these
*/
// @codingStandardsIgnoreStart
global $WPGlobus;
global $WPGlobus_Options;
// @codingStandardsIgnoreEnd
/**
* Compatibility functions.
*
* @since 1.6.4
*/
require_once dirname( __FILE__ ) . '/includes/compat/mbstring.php';
/**
* Abstract class for plugins.
*
* @since 1.6.1
*/
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-plugin.php';
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-config.php';
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-utils.php';
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-wp.php';
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-widget.php';
require_once dirname( __FILE__ ) . '/includes/class-wpglobus.php';
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-core.php';
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-rest-api.php';
/**
* Admin page helpers.
*
* @since 1.6.5
*/
require_once dirname( __FILE__ ) . '/includes/admin/class-wpglobus-admin-page.php';
/**
* Initialize
*
* @todo Rename uppercase variables.
*/
// @codingStandardsIgnoreStart
WPGlobus::$PLUGIN_DIR_PATH = plugin_dir_path( __FILE__ );
WPGlobus::$PLUGIN_DIR_URL = plugin_dir_url( __FILE__ );
// @codingStandardsIgnoreEnd
WPGlobus::Config();
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-filters.php';
require_once dirname( __FILE__ ) . '/includes/wpglobus-controller.php';
WPGlobus_Rest_API::construct();
/**
* Support for Yoast SEO
*/
require_once dirname( __FILE__ ) . '/includes/wpglobus-yoastseo.php';
/**
* Support of theme option panels and customizer
*
* @since 1.4.0
*/
require_once dirname( __FILE__ ) . '/includes/admin/customize/wpglobus-customize.php';
/**
* To disable WPGlobus Customizer Options, put this to wp-config:
* define( 'WPGLOBUS_CUSTOMIZE', false )
*
* @since 1.8.6
*/
if ( ! defined( 'WPGLOBUS_CUSTOMIZE' ) || WPGLOBUS_CUSTOMIZE ) {
/**
* WPGlobus customize options
*
* @since 1.4.6
*/
require_once dirname( __FILE__ ) . '/includes/admin/class-wpglobus-customize-options.php';
WPGlobus_Customize_Options::controller();
}
// TODO remove this old updater.
//require_once dirname( __FILE__ ) . '/updater/class-wpglobus-updater.php';
/**
* TIVWP Updater.
*
* @since 1.5.9
*/
if (
version_compare( PHP_VERSION, '5.3.0', '>=' )
&& file_exists( dirname( __FILE__ ) . '/vendor/tivwp/updater/updater.php' )
) {
require_once dirname( __FILE__ ) . '/vendor/tivwp/updater/updater.php';
}
/**
* WPGlobus Post Types
*
* @since 1.9.10
*/
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-post-types.php';
/**
* WPGlobus Widgets.
*
* @since 2.8.6
*/
if ( WPGlobus::Config()->use_widgets_block_editor ) {
require_once dirname( __FILE__ ) . '/includes/widgets/class-wpglobus-widgets.php';
WPGlobus_Widgets::get_instance( __FILE__ );
}
/**
* In admin area
*/
if ( WPGlobus_WP::in_wp_admin() ) :
/**
* HelpDesk
*
* @since 1.6.5
*/
require_once dirname( __FILE__ ) . '/includes/admin/helpdesk/class-wpglobus-admin-helpdesk.php';
WPGlobus_Admin_HelpDesk::construct();
/**
* WPGlobus Admin.
*
* @since 1.8.1
*/
require_once dirname( __FILE__ ) . '/includes/admin/wpglobus-admin.php';
/**
* WPGlobus News admin dashboard widget.
*
* @since 1.7.7
*/
require_once dirname( __FILE__ ) . '/includes/admin/class-wpglobus-dashboard-news.php';
new WPGlobus_Dashboard_News();
/**
* WPGlobus News admin dashboard widget.
*
* @since 1.7.8
*/
require_once dirname( __FILE__ ) . '/includes/admin/class-wpglobus-admin-menu.php';
WPGlobus_Admin_Menu::construct();
/**
* WPGlobus Recommendations.
* To disable recommendations, put this to wp-config:
* define( 'WPGLOBUS_RECOMMENDATIONS', false );
*
* @since 1.8.7
*/
if ( ! defined( 'WPGLOBUS_RECOMMENDATIONS' ) || WPGLOBUS_RECOMMENDATIONS ) {
require_once dirname( __FILE__ ) . '/includes/admin/recommendations/class-wpglobus-admin-recommendations.php';
WPGlobus_Admin_Recommendations::setup_hooks();
}
/**
* WPGlobus with Gutenberg widgets block editor.
* To disable, put this to wp-config:
* define( 'WPGLOBUS_GUTENBERG_WIDGETS_BLOCK_EDITOR', false );
*
* @since 2.7.2
* @deprecated 2.8.0
* <code>
* // if ( ! defined('WPGLOBUS_GUTENBERG_WIDGETS_BLOCK_EDITOR') || WPGLOBUS_GUTENBERG_WIDGETS_BLOCK_EDITOR ) {
* // if ( defined('GUTENBERG_VERSION') ) {
* // require_once dirname( __FILE__ ) . '/includes/admin/gutenberg/class-wpglobus-admin-gutenberg.php';
* // WPGlobus_Admin_Gutenberg::construct();
* // }
* // }
* </code>
*/
endif;
/**
* At the front
*/
if ( ! is_admin() && ! WPGlobus_WP::is_doing_ajax() ) :
/**
* First-time automatic redirect to the primary language specified in the browser.
*
* @since 1.8.0
*/
/* @noinspection NestedPositiveIfStatementsInspection */
if ( isset( WPGlobus::Config()->browser_redirect['redirect_by_language'] ) && WPGlobus::Config()->browser_redirect['redirect_by_language'] ) {
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-redirect.php';
WPGlobus_Redirect::construct();
}
endif;