PluginProbe
WPGlobus / 3.0.1
WPGlobus v3.0.1
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.1, at wpglobus.php

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