automattic / jetpack-plugin-deactivation
在停用插件时请求反馈
v0.2.2
2024-08-29 08:39 UTC
Requires
- php: >=7.0
- automattic/jetpack-assets: ^2.3.5
Requires (Dev)
- automattic/jetpack-changelogger: ^4.2.6
- yoast/phpunit-polyfills: ^1.1.1
Suggests
- automattic/jetpack-autoloader: Allow for better interoperability with other plugins that use this package.
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(或更高版本)授权