-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlw-zenadmin.php
More file actions
71 lines (62 loc) · 1.83 KB
/
Copy pathlw-zenadmin.php
File metadata and controls
71 lines (62 loc) · 1.83 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
68
69
70
71
<?php
/**
* Plugin Name: LW ZenAdmin
* Plugin URI: https://github.com/lwplugins/lw-zenadmin
* Description: Lightweight admin cleanup — notices sidebar, dashboard widgets, admin menu, and admin bar manager.
* Version: 1.3.0
* Requires at least: 6.0
* Requires PHP: 8.0
* 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-zenadmin
* Domain Path: /languages
*
* @package LightweightPlugins\ZenAdmin
*/
declare(strict_types=1);
namespace LightweightPlugins\ZenAdmin;
// Prevent direct access.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Plugin constants.
define( 'LW_ZENADMIN_VERSION', '1.3.0' );
define( 'LW_ZENADMIN_FILE', __FILE__ );
define( 'LW_ZENADMIN_PATH', plugin_dir_path( __FILE__ ) );
define( 'LW_ZENADMIN_URL', plugin_dir_url( __FILE__ ) );
// Autoloader: local vendor (standalone/ZIP) or root Composer (dependency install).
if ( file_exists( LW_ZENADMIN_PATH . 'vendor/autoload.php' ) ) {
require_once LW_ZENADMIN_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 ZenAdmin:</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-zenadmin' )
);
}
);
return;
}
/**
* Returns the main plugin instance.
*
* @return Plugin
*/
function lw_zenadmin(): Plugin {
static $instance = null;
if ( null === $instance ) {
$instance = new Plugin();
}
return $instance;
}
// Initialize the plugin.
add_action(
'plugins_loaded',
static function (): void {
lw_zenadmin();
}
);