majormfr / majormfr-whitelist
Library to assist whitelisting of posts and pages
v1.1
2023-07-31 18:58 UTC
Requires
- php: ^7.4 || ^8.0
- psr/container: ^1.0 || ^2.0
README
Library to remove unauthorized plugins. Specify url that with following route
https://{my_domain}.com/whitelist/plugins
Above should return an array with key "whitelist_plugins"
Install Composer in wordpress project
Installation
To deploy this project run
composer init
Install package
composer require majormfr/majormfr-whitelist
In your custom plugin or functions.php file
Gates::specifyWhitelistedUrl("https://{my_domains}.com/whitelist/plugins"); $whitelistPlugins = Gates::fetch_whitelisted_plugins()['whitelist_plugins'] ?? []; $installed_plugins = Gates::fetch_plugins_bpd_from_db();
and
if (count($whitelistPlugins) > 0) { echo count($whitelistPlugins); add_action('admin_init', array('Majormfr\MajormfrWhitelist\Includes\Gates\Gates', 'disableUnknownPlugins')); }
Expected array from your mentioned url should be:
['wordpress-importer/wordpress-importer.php','google-captcha/google-captcha.php'...]