1 | <?php // -*- coding: utf-8 -*- |
||||||
2 | declare(strict_types=1); |
||||||
3 | |||||||
4 | /** |
||||||
5 | * Plugin Name: Multisite Global Media |
||||||
6 | * Description: Multisite Global Media is a WordPress plugin which shares media across the Multisite network. |
||||||
7 | * Network: true |
||||||
8 | * Plugin URI: https://github.com/bueltge/multisite-global-media |
||||||
9 | * Version: 0.1.0-dev-4 |
||||||
10 | * Author: Dominik Schilling, Frank Bültge, Guido Scialfa |
||||||
11 | * License: GPLv2+ |
||||||
12 | * License URI: ./LICENSE |
||||||
13 | * Text Domain: multisite-global-media |
||||||
14 | * Domain Path: /languages |
||||||
15 | * |
||||||
16 | * Php Version 7 |
||||||
17 | * |
||||||
18 | * @package WordPress |
||||||
19 | * @author Dominik Schilling <[email protected]>, Frank Bültge <[email protected]> |
||||||
20 | * @license https://opensource.org/licenses/GPL-2.0 |
||||||
21 | * @version 2019-09-13 |
||||||
22 | */ |
||||||
23 | |||||||
24 | namespace MultisiteGlobalMedia; |
||||||
25 | |||||||
26 | // phpcs:disable |
||||||
27 | |||||||
28 | $bootstrap = \Closure::bind( |
||||||
29 | static function () { |
||||||
30 | /** |
||||||
31 | * @param string $message |
||||||
32 | * @param string $noticeType |
||||||
33 | * @param array $allowedMarkup |
||||||
34 | */ |
||||||
35 | function adminNotice($message, $noticeType, array $allowedMarkup = []) |
||||||
36 | { |
||||||
37 | \assert(\is_string($message) && \is_string($noticeType)); |
||||||
38 | |||||||
39 | add_action( |
||||||
40 | 'admin_notices', |
||||||
41 | function () use ($message, $noticeType, $allowedMarkup) { |
||||||
42 | ?> |
||||||
43 | <div class="notice notice-<?= esc_attr($noticeType) ?>"> |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
44 | <p><?= wp_kses($message, $allowedMarkup) ?></p> |
||||||
0 ignored issues
–
show
The function
wp_kses was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
45 | </div> |
||||||
46 | <?php |
||||||
47 | } |
||||||
48 | ); |
||||||
49 | } |
||||||
50 | |||||||
51 | /** |
||||||
52 | * @return bool |
||||||
53 | */ |
||||||
54 | function autoload() |
||||||
55 | { |
||||||
56 | if (\class_exists(PluginProperties::class)) { |
||||||
57 | return true; |
||||||
58 | } |
||||||
59 | |||||||
60 | $autoloader = plugin_dir_path(__FILE__) . '/vendor/autoload.php'; |
||||||
0 ignored issues
–
show
The function
plugin_dir_path was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
61 | |||||||
62 | if (!\file_exists($autoloader)) { |
||||||
63 | return false; |
||||||
64 | } |
||||||
65 | |||||||
66 | /** @noinspection PhpIncludeInspection */ |
||||||
67 | require_once $autoloader; |
||||||
68 | |||||||
69 | return true; |
||||||
70 | } |
||||||
71 | |||||||
72 | /** |
||||||
73 | * Compare PHP Version with our minimum. |
||||||
74 | * |
||||||
75 | * @return bool |
||||||
76 | */ |
||||||
77 | function isPhpVersionCompatible() |
||||||
78 | { |
||||||
79 | return PHP_VERSION_ID >= 70000; |
||||||
80 | } |
||||||
81 | |||||||
82 | if (!isPhpVersionCompatible()) { |
||||||
83 | adminNotice( |
||||||
84 | sprintf( |
||||||
85 | // Translators: %s is the PHP version of the current installation, where is the plugin is active. |
||||||
86 | __( |
||||||
0 ignored issues
–
show
The function
__ was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
87 | 'Multisite Global Media require php version 7.0 at least. Your\'s is %s', |
||||||
88 | 'multisite-global-media' |
||||||
89 | ), |
||||||
90 | PHP_VERSION |
||||||
91 | ), |
||||||
92 | 'error' |
||||||
93 | ); |
||||||
94 | |||||||
95 | return; |
||||||
96 | } |
||||||
97 | if (!autoload()) { |
||||||
98 | adminNotice( |
||||||
99 | __( |
||||||
100 | 'No suitable autoloader found. Multisite Global Media cannot be loaded correctly.', |
||||||
101 | 'multisite-global-media' |
||||||
102 | ), |
||||||
103 | 'error' |
||||||
104 | ); |
||||||
105 | |||||||
106 | return; |
||||||
107 | } |
||||||
108 | |||||||
109 | $plugin = new Plugin(__FILE__); |
||||||
110 | $plugin->onLoad(); |
||||||
111 | }, null); |
||||||
112 | $bootstrap(); |
||||||
113 |