piotrpress/wordpress-notice

该库简化了在WordPress仪表板中显示通知的功能。

v1.1.0 2024-09-16 12:41 UTC

This package is auto-updated.

Last update: 2024-09-16 12:42:36 UTC


README

该库简化了在WordPress仪表板中显示通知的功能。

安装

$ composer require piotrpress/wordpress-notice

示例

require __DIR__ . '/vendor/autoload.php';

namespace PiotrPress\WordPress;

// Example #1
echo new Notice( 'This is an example notice message', Notice::ERROR );

// Example #2
Hooks::add( new Notice( 'This is an example notice message', Notice::ERROR ) );

参数

  • string $message - 通知消息。
  • string $type - 通知类型。可能的值有 Notice::INFONotice::SUCCESSNotice::WARNINGNotice::ERROR。默认是 null
  • bool $dismissible - 通知是否可忽略。可能的值有 truefalse。默认是 false
  • bool $alt - 通知的替代显示样式(带有填充背景)。可能的值有 truefalse。默认是 false

需求

PHP >= 7.4 版本。

许可证

GPL3.0