majormfr/majormfr-whitelist

辅助对帖子页面进行白名单设置的库

v1.1 2023-07-31 18:58 UTC

This package is auto-updated.

Last update: 2024-09-30 01:49:10 UTC


README

用于移除未经授权插件的库。指定以下路由的url

https://{my_domain}.com/whitelist/plugins

上述应返回包含键 "whitelist_plugins" 的数组

在WordPress项目中安装Composer

安装

要部署此项目,请运行

  composer init

安装包

  composer require majormfr/majormfr-whitelist

在你的自定义插件或functions.php文件中

    Gates::specifyWhitelistedUrl("https://{my_domains}.com/whitelist/plugins");

   $whitelistPlugins = Gates::fetch_whitelisted_plugins()['whitelist_plugins'] ?? [];
    $installed_plugins = Gates::fetch_plugins_bpd_from_db();
    

并且

  if (count($whitelistPlugins) > 0) {
        echo count($whitelistPlugins);
        add_action('admin_init', array('Majormfr\MajormfrWhitelist\Includes\Gates\Gates', 'disableUnknownPlugins'));
    }

从你提到的url期望的数组应该是

['wordpress-importer/wordpress-importer.php','google-captcha/google-captcha.php'...]