| 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-2021 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: 2.7.14 |
| 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', '2.7.14' ); |
| 48 |
define( 'WPGLOBUS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
| 49 |
define( 'WPGLOBUS_AJAX', 'wpglobus-ajax' ); |
| 50 |
|
| 51 |
/** |
| 52 |
* WP Requirements library. |
| 53 |
* |
| 54 |
* @since 1.6.4 |
| 55 |
*/ |
| 56 |
if ( is_readable( dirname( __FILE__ ) . '/vendor/bemailr/wp-requirements/wpr-loader.php' ) ) { |
| 57 |
require_once dirname( __FILE__ ) . '/vendor/bemailr/wp-requirements/wpr-loader.php'; |
| 58 |
} |
| 59 |
|
| 60 |
/** @todo Get rid of these */ |
| 61 |
// @codingStandardsIgnoreStart |
| 62 |
global $WPGlobus; |
| 63 |
global $WPGlobus_Options; |
| 64 |
// @codingStandardsIgnoreEnd |
| 65 |
|
| 66 |
/** |
| 67 |
* Compatibility functions. |
| 68 |
* |
| 69 |
* @since 1.6.4 |
| 70 |
*/ |
| 71 |
require_once dirname( __FILE__ ) . '/includes/compat/mbstring.php'; |
| 72 |
|
| 73 |
/** |
| 74 |
* Abstract class for plugins. |
| 75 |
* |
| 76 |
* @since 1.6.1 |
| 77 |
*/ |
| 78 |
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-plugin.php'; |
| 79 |
|
| 80 |
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-config.php'; |
| 81 |
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-utils.php'; |
| 82 |
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-wp.php'; |
| 83 |
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-widget.php'; |
| 84 |
require_once dirname( __FILE__ ) . '/includes/class-wpglobus.php'; |
| 85 |
|
| 86 |
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-core.php'; |
| 87 |
|
| 88 |
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-rest-api.php'; |
| 89 |
|
| 90 |
/** |
| 91 |
* Admin page helpers. |
| 92 |
* |
| 93 |
* @since 1.6.5 |
| 94 |
*/ |
| 95 |
require_once dirname( __FILE__ ) . '/includes/admin/class-wpglobus-admin-page.php'; |
| 96 |
|
| 97 |
/** |
| 98 |
* Initialize |
| 99 |
* |
| 100 |
* @todo Rename uppercase variables. |
| 101 |
*/ |
| 102 |
// @codingStandardsIgnoreStart |
| 103 |
WPGlobus::$PLUGIN_DIR_PATH = plugin_dir_path( __FILE__ ); |
| 104 |
WPGlobus::$PLUGIN_DIR_URL = plugin_dir_url( __FILE__ ); |
| 105 |
// @codingStandardsIgnoreEnd |
| 106 |
WPGlobus::Config(); |
| 107 |
|
| 108 |
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-filters.php'; |
| 109 |
require_once dirname( __FILE__ ) . '/includes/wpglobus-controller.php'; |
| 110 |
|
| 111 |
WPGlobus_Rest_API::construct(); |
| 112 |
|
| 113 |
/** |
| 114 |
* Support for Yoast SEO |
| 115 |
*/ |
| 116 |
require_once dirname( __FILE__ ) . '/includes/wpglobus-yoastseo.php'; |
| 117 |
|
| 118 |
/** |
| 119 |
* Support of theme option panels and customizer |
| 120 |
* |
| 121 |
* @since 1.4.0 |
| 122 |
*/ |
| 123 |
require_once dirname( __FILE__ ) . '/includes/admin/customize/wpglobus-customize.php'; |
| 124 |
|
| 125 |
/** |
| 126 |
* To disable WPGlobus Customizer Options, put this to wp-config: |
| 127 |
* define( 'WPGLOBUS_CUSTOMIZE', false ) |
| 128 |
* |
| 129 |
* @since 1.8.6 |
| 130 |
*/ |
| 131 |
if ( ! defined( 'WPGLOBUS_CUSTOMIZE' ) || WPGLOBUS_CUSTOMIZE ) { |
| 132 |
/** |
| 133 |
* WPGlobus customize options |
| 134 |
* |
| 135 |
* @since 1.4.6 |
| 136 |
*/ |
| 137 |
require_once dirname( __FILE__ ) . '/includes/admin/class-wpglobus-customize-options.php'; |
| 138 |
WPGlobus_Customize_Options::controller(); |
| 139 |
} |
| 140 |
|
| 141 |
// TODO remove this old updater. |
| 142 |
//require_once dirname( __FILE__ ) . '/updater/class-wpglobus-updater.php'; |
| 143 |
|
| 144 |
/** |
| 145 |
* TIVWP Updater. |
| 146 |
* |
| 147 |
* @since 1.5.9 |
| 148 |
*/ |
| 149 |
if ( |
| 150 |
version_compare( PHP_VERSION, '5.3.0', '>=' ) |
| 151 |
&& file_exists( dirname( __FILE__ ) . '/vendor/tivwp/updater/updater.php' ) |
| 152 |
) { |
| 153 |
require_once dirname( __FILE__ ) . '/vendor/tivwp/updater/updater.php'; |
| 154 |
} |
| 155 |
|
| 156 |
/** |
| 157 |
* WPGlobus Post Types |
| 158 |
* |
| 159 |
* @since 1.9.10 |
| 160 |
*/ |
| 161 |
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-post-types.php'; |
| 162 |
|
| 163 |
/** |
| 164 |
* In admin area |
| 165 |
*/ |
| 166 |
if ( WPGlobus_WP::in_wp_admin() ) : |
| 167 |
|
| 168 |
/** |
| 169 |
* HelpDesk |
| 170 |
* |
| 171 |
* @since 1.6.5 |
| 172 |
*/ |
| 173 |
require_once dirname( __FILE__ ) . '/includes/admin/helpdesk/class-wpglobus-admin-helpdesk.php'; |
| 174 |
WPGlobus_Admin_HelpDesk::construct(); |
| 175 |
|
| 176 |
/** |
| 177 |
* WPGlobus Admin. |
| 178 |
* |
| 179 |
* @since 1.8.1 |
| 180 |
*/ |
| 181 |
require_once dirname( __FILE__ ) . '/includes/admin/wpglobus-admin.php'; |
| 182 |
|
| 183 |
/** |
| 184 |
* WPGlobus News admin dashboard widget. |
| 185 |
* |
| 186 |
* @since 1.7.7 |
| 187 |
*/ |
| 188 |
require_once dirname( __FILE__ ) . '/includes/admin/class-wpglobus-dashboard-news.php'; |
| 189 |
new WPGlobus_Dashboard_News(); |
| 190 |
|
| 191 |
/** |
| 192 |
* WPGlobus News admin dashboard widget. |
| 193 |
* |
| 194 |
* @since 1.7.8 |
| 195 |
*/ |
| 196 |
require_once dirname( __FILE__ ) . '/includes/admin/class-wpglobus-admin-menu.php'; |
| 197 |
WPGlobus_Admin_Menu::construct(); |
| 198 |
|
| 199 |
/** |
| 200 |
* WPGlobus Recommendations. |
| 201 |
* To disable recommendations, put this to wp-config: |
| 202 |
* define( 'WPGLOBUS_RECOMMENDATIONS', false ); |
| 203 |
* |
| 204 |
* @since 1.8.7 |
| 205 |
*/ |
| 206 |
if ( ! defined( 'WPGLOBUS_RECOMMENDATIONS' ) || WPGLOBUS_RECOMMENDATIONS ) { |
| 207 |
require_once dirname( __FILE__ ) . '/includes/admin/recommendations/class-wpglobus-admin-recommendations.php'; |
| 208 |
WPGlobus_Admin_Recommendations::setup_hooks(); |
| 209 |
} |
| 210 |
|
| 211 |
/** |
| 212 |
* WPGlobus with Gutenberg widgets block editor. |
| 213 |
* To disable, put this to wp-config: |
| 214 |
* define( 'WPGLOBUS_GUTENBERG_WIDGETS_BLOCK_EDITOR', false ); |
| 215 |
* |
| 216 |
* @since 2.7.2 |
| 217 |
*/ |
| 218 |
if ( ! defined('WPGLOBUS_GUTENBERG_WIDGETS_BLOCK_EDITOR') || WPGLOBUS_GUTENBERG_WIDGETS_BLOCK_EDITOR ) { |
| 219 |
if ( defined('GUTENBERG_VERSION') ) { |
| 220 |
require_once dirname( __FILE__ ) . '/includes/admin/gutenberg/class-wpglobus-admin-gutenberg.php'; |
| 221 |
WPGlobus_Admin_Gutenberg::construct(); |
| 222 |
} |
| 223 |
} |
| 224 |
|
| 225 |
endif; |
| 226 |
|
| 227 |
/** |
| 228 |
* At the front |
| 229 |
*/ |
| 230 |
if ( ! is_admin() && ! WPGlobus_WP::is_doing_ajax() ) : |
| 231 |
|
| 232 |
/** |
| 233 |
* First-time automatic redirect to the primary language specified in the browser. |
| 234 |
* |
| 235 |
* @since 1.8.0 |
| 236 |
*/ |
| 237 |
|
| 238 |
/* @noinspection NestedPositiveIfStatementsInspection */ |
| 239 |
if ( isset( WPGlobus::Config()->browser_redirect['redirect_by_language'] ) && WPGlobus::Config()->browser_redirect['redirect_by_language'] ) { |
| 240 |
require_once dirname( __FILE__ ) . '/includes/class-wpglobus-redirect.php'; |
| 241 |
WPGlobus_Redirect::construct(); |
| 242 |
} |
| 243 |
|
| 244 |
endif; |
| 245 |
|