-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmultilingualpress-yoast-seo-sync.php
94 lines (83 loc) · 2.38 KB
/
multilingualpress-yoast-seo-sync.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
<?php // phpcs:disable
/*
* Plugin Name: MultilingualPress 3 Yoast SEO Sync
* Plugin URI:
* Description: Translate Yoast SEO post metadata between translated posts.
* Author: Inpsyde GmbH
* Author URI: https://inpsyde.com
* Version: 2.1.2
* Text Domain: multilingualpress-yoast-seo-sync
* Domain Path: /languages/
* License: GPLv2+
* Network: true
* Requires at least: 5.0
* Requires PHP: 7.2
*/
namespace Inpsyde\MultilingualPress\YoastSeoSync;
use Inpsyde\MultilingualPress\Framework\Service\ServiceProvidersCollection;
if (version_compare(PHP_VERSION, '7.2', '<')) {
$hooks = [
'admin_notices',
'network_admin_notices',
];
foreach ($hooks as $hook) {
add_action($hook, function () {
$message = __(
'MultilingualPress Yoast SEO Sync requires at least PHP version 7. <br />Please ask your server administrator to update your environment to PHP version 7.',
'multilingualpress-yoast-seo-sync'
);
printf(
'<div class="notice notice-error"><span class="notice-title">%1$s</span><p>%2$s</p></div>',
esc_html__(
'The plugin MultilingualPress Yoast SEO Sync has been deactivated',
'multilingualpress-yoast-seo-sync'
),
wp_kses($message, ['br' => true])
);
deactivate_plugins(plugin_basename(__FILE__));
});
}
return;
}
function autoload()
{
static $done;
if (is_bool($done)) {
return $done;
}
if (class_exists(PluginProperties::class)) {
$done = true;
return true;
}
if (is_readable(__DIR__ . '/autoload.php')) {
require_once __DIR__ . '/autoload.php';
$done = true;
return true;
}
if (is_readable(__DIR__ . '/vendor/autoload.php')) {
require_once __DIR__ . '/vendor/autoload.php';
$done = true;
return true;
}
$done = false;
return false;
}
if (!autoload()) {
return;
}
/**
* Bootstraps MultilingualPress Yoast SEO Sync.
*
* @return bool
*
* @wp-hook multilingualpress.add_service_providers
*/
add_action(
'multilingualpress.add_service_providers',
function (ServiceProvidersCollection $providers) {
$providers
->add(new Core\ServiceProvider())
->add(new TranslationUi\ServiceProvider());
},
0
);