| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Disk Usage Insights |
| 4 |
* Plugin URI: https://github.com/mgleis/disk-usage-insights |
| 5 |
* Description: Find large files and folders in your WordPress installation in no time! |
| 6 |
* Author: Marcel Gleis |
| 7 |
* License: GPLv3 |
| 8 |
* Version: 1.11 |
| 9 |
* Requires PHP: 7.4 |
| 10 |
*/ |
| 11 |
const DISK_USAGE_INSIGHTS_VERSION = '1.11'; |
| 12 |
|
| 13 |
// Ensure running within WordPress |
| 14 |
if (!defined('ABSPATH')) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
add_action('plugins_loaded', 'mgleis_diskusageinsights_init_plugin'); |
| 19 |
|
| 20 |
function mgleis_diskusageinsights_init_plugin() { |
| 21 |
|
| 22 |
// Ensure the admin interface is in use |
| 23 |
if (!is_admin()) { |
| 24 |
return; |
| 25 |
} |
| 26 |
|
| 27 |
// If site is a multisite: Ensure the logged in user has SuperAdmin privileges |
| 28 |
if (is_multisite() && !current_user_can('manage_sites')) { |
| 29 |
return; |
| 30 |
} |
| 31 |
|
| 32 |
// initialize plugin |
| 33 |
require_once __DIR__.'/vendor/autoload.php'; |
| 34 |
$plugin = new Mgleis\DiskUsageInsights\Plugin(DISK_USAGE_INSIGHTS_VERSION); |
| 35 |
$plugin->init(); |
| 36 |
} |
| 37 |
|