automattic/jetpack-plugin-deactivation

在停用插件时请求反馈

安装量: 2,558

依赖项: 1

建议者: 0

安全性: 0

星标: 1

关注者: 4

分支: 0

类型:jetpack-library

v0.2.2 2024-08-29 08:39 UTC

This package is auto-updated.

Last update: 2024-09-18 03:17:48 UTC


README

通过对话框拦截插件停用

如何安装插件停用

通过提供$plugin_slug$dialog_view_file_path作为参数来实例化Deactivation_Handler

add_action( 'init', function() {
	Automattic\Jetpack\Plugin_Deactivation\Deactivation_Handler::init( $plugin_slug, $dialog_view_file_path );
} );

控制对话框

使用属性

您可以在任何元素上使用data-jp-plugin-deactivation-action属性,其值可以是close|deactivate。添加此属性将观察该元素并根据属性值关闭或停用插件。

关闭对话框的按钮示例

<button 
		type="button"
		class="jp-plugin-deactivation__button"
		data-jp-plugin-deactivation-action="close"
	>Cancel</button>

使用实例

您可以在window.JetpackPluginDeactivationData[<plugin slug>]中访问停用对话框实例。它有访问以下方法的能力

  • showDialog() - 打开停用对话框
  • hideDialog() - 关闭停用对话框
  • deactivate() - 停用插件并关闭对话框

在您的WordPress插件中使用此包

如果您计划在WordPress插件中使用此包,我们建议您使用Jetpack Autoloader作为自动加载器。这将允许与其他使用此包的插件实现最大程度的互操作性。

安全性

需要报告安全漏洞?请访问https://automattic.com/security/或直接访问我们的安全漏洞赏金网站https://hackerone.com/automattic

许可证

插件停用根据GNU通用公共许可证v2(或更高版本)授权