-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquick-multilingual.php
More file actions
65 lines (59 loc) · 2.05 KB
/
Copy pathquick-multilingual.php
File metadata and controls
65 lines (59 loc) · 2.05 KB
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
<?php
/**
* Plugin Name: Quick Multilingual
* Description: Quick Multilingual allows you to create multilingual brochure sites on WordPress with automatic language attributes, hreflang tags and canonical URLs.
* Author: Pieter Bos
* Author URI: https://so-wp.com
* Version: 2.0.0
* Requires at least: 6.2
* Tested up to: 7.1
* Requires PHP: 8.2
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: quick-multilingual
* GitHub Plugin URI: https://github.com/senlin/quick-multilingual
* GitHub Branch: main
*
* @package SOWP\QuickMultilingual
* @author Pieter Bos
* @since 1.0.0
*/
// Don't load the plugin file directly.
defined( 'ABSPATH' ) || exit;
define( 'SO_QMP_VERSION', '2.0.0' );
define( 'SO_QMP_FILE', __FILE__ );
define( 'SO_QMP_DIR', plugin_dir_path( __FILE__ ) );
define( 'SO_QMP_URL', plugin_dir_url( __FILE__ ) );
define( 'SO_QMP_BASENAME', plugin_basename( __FILE__ ) );
// Hard floor: bail gracefully on PHP < 8.2 (WP's Requires PHP header also blocks activation).
if ( version_compare( PHP_VERSION, '8.2', '<' ) ) {
add_action(
'admin_notices',
static function () {
printf(
'<div class="notice notice-error"><p>%s</p></div>',
esc_html__( 'Quick Multilingual requires PHP 8.2 or higher and has been disabled.', 'quick-multilingual' )
);
}
);
return;
}
/**
* PSR-4 autoloader for the SOWP\QuickMultilingual namespace.
* Composer can replace this by adding vendor/autoload.php if desired.
*/
spl_autoload_register(
static function ( string $class ): void {
$prefix = 'SOWP\\QuickMultilingual\\';
if ( ! str_starts_with( $class, $prefix ) ) {
return;
}
$relative = substr( $class, strlen( $prefix ) );
$path = SO_QMP_DIR . 'src/' . str_replace( '\\', '/', $relative ) . '.php';
if ( is_file( $path ) ) {
require_once $path;
}
}
);
register_activation_hook( __FILE__, [ \SOWP\QuickMultilingual\Activation::class, 'activate' ] );
\SOWP\QuickMultilingual\Plugin::instance()->run();