-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathms-featured-image.php
executable file
·59 lines (51 loc) · 1.75 KB
/
ms-featured-image.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
<?php
/**
* Plugin Name: Multisite Featured Image
* Plugin URI: https://frosty.media/plugins/multisite-featured-image/
* Description: Adds a featured image to each site in a WordPress Multisite Network.
* Version: 3.2.0
* Author: Austin Passy
* Author URI: https://austin.passy.co
* Text Domain: ms-featured-image
* License: GPL-2.0+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
* Network: true
* GitHub Plugin URI: https://github.com/Frosty-Media/ms-featured-image
* GitHub Branch: master
* Requires WP: 6.0
* Requires PHP: 7.4
*/
use FrostyMedia\MSFeaturedImage\FeaturedImage;
use FrostyMedia\MSFeaturedImage\Psr4Autoloader;
// Exit if accessed directly
defined('ABSPATH') || exit;
if (version_compare(phpversion(), '7.4', '>=')) {
require_once __DIR__ . '/src/Psr4Autoloader.php';
(new Psr4Autoloader())->addNamespace('FrostyMedia\MSFeaturedImage', __DIR__ . '/src')->register();
define(FeaturedImage::class . '_FILE', __FILE__);
FeaturedImage::instance();
} else {
if (defined('WP_CLI') && WP_CLI && method_exists('WP_CLI', 'warning')) {
WP_CLI::warning(_ms_featured_image_php_version_text());
} else {
return add_action('network_admin_notices', '_ms_featured_image_php_version_error');
}
}
/**
* Admin notice for incompatible versions of PHP.
*/
function _ms_featured_image_php_version_error()
{
printf('<div class="error"><p>%s</p></div>', _ms_featured_image_php_version_text());
}
/**
* String describing the minimum PHP version.
* @return string
*/
function _ms_featured_image_php_version_text()
{
return esc_html__(
'Multisite Featured Image plugin error: Your version of PHP is too old to run this plugin. You must be running PHP 7.4 or higher.',
'ms-featured-image'
);
}