-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlw-enable.php
More file actions
67 lines (58 loc) · 1.63 KB
/
Copy pathlw-enable.php
File metadata and controls
67 lines (58 loc) · 1.63 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
66
67
<?php
/**
* Plugin Name: LW Enable
* Plugin URI: https://github.com/lwplugins/lw-enable
* Description: Lightweight enable — SVG uploads and more.
* Version: 1.0.12
* Requires at least: 6.0
* Requires PHP: 8.2
* Author: LW Plugins
* Author URI: https://lwplugins.com
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: lw-enable
*
* @package LightweightPlugins\Enable
*/
declare(strict_types=1);
namespace LightweightPlugins\Enable;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
define( 'LW_ENABLE_VERSION', '1.0.12' );
define( 'LW_ENABLE_FILE', __FILE__ );
define( 'LW_ENABLE_PATH', plugin_dir_path( __FILE__ ) );
define( 'LW_ENABLE_URL', plugin_dir_url( __FILE__ ) );
// Autoloader: local vendor (standalone/ZIP) or root Composer (dependency install).
if ( file_exists( LW_ENABLE_PATH . 'vendor/autoload.php' ) ) {
require_once LW_ENABLE_PATH . 'vendor/autoload.php';
} elseif ( ! class_exists( Plugin::class ) ) {
add_action(
'admin_notices',
static function (): void {
printf(
'<div class="notice notice-error"><p><strong>LW Enable:</strong> %s</p></div>',
esc_html__( 'Autoloader not found. Please run "composer install" in the plugin directory, or re-install the plugin from a release ZIP.', 'lw-enable' )
);
}
);
return;
}
/**
* Initialize plugin.
*
* @return Plugin
*/
function lw_enable(): Plugin {
static $instance = null;
if ( null === $instance ) {
$instance = new Plugin();
}
return $instance;
}
add_action(
'plugins_loaded',
static function (): void {
lw_enable();
}
);