| @@ -41,13 +41,13 @@ | ||
| 41 | 41 | public const OPTION_NAME = WIND_PRESS::WP_OPTION . '_notices'; |
| 42 | 42 | /** |
| 43 | 43 | * Get lists of notices. |
| 44 | 44 | */ |
| 45 | - public static function get_lists(?bool $purge = \true) : array | |
| 45 | + public static function get_lists(?bool $purge = \true): array | |
| 46 | 46 | { |
| 47 | - $notices = \get_option(self::OPTION_NAME, []); | |
| 47 | + $notices = get_option(self::OPTION_NAME, []); | |
| 48 | 48 | if ($purge) { |
| 49 | - \update_option(self::OPTION_NAME, []); | |
| 49 | + update_option(self::OPTION_NAME, []); | |
| 50 | 50 | } |
| 51 | 51 | return $notices; |
| 52 | 52 | } |
| 53 | 53 | /** |
| @@ -53,26 +53,26 @@ | ||
| 53 | 53 | /** |
| 54 | 54 | * Callback for the admin_notices action. |
| 55 | 55 | * Prints the notices in the admin page. |
| 56 | 56 | */ |
| 57 | - public static function admin_notices() : void | |
| 57 | + public static function admin_notices(): void | |
| 58 | 58 | { |
| 59 | 59 | $messages = self::get_lists(); |
| 60 | - if ($messages && \is_array($messages)) { | |
| 60 | + if ($messages && is_array($messages)) { | |
| 61 | 61 | foreach ($messages as $message) { |
| 62 | - echo \sprintf('<div class="notice notice-%s is-dismissible %s">%s</div>', \esc_attr($message['status']), \esc_attr(self::OPTION_NAME), \wp_kses_post($message['message'])); | |
| 62 | + echo sprintf('<div class="notice notice-%s is-dismissible %s">%s</div>', esc_attr($message['status']), esc_attr(self::OPTION_NAME), wp_kses_post($message['message'])); | |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | - public static function add(string $status, string $message, ?string $key = null, bool $unique = \false) : void | |
| 66 | + public static function add(string $status, string $message, ?string $key = null, bool $unique = \false): void | |
| 67 | 67 | { |
| 68 | - $notices = \get_option(self::OPTION_NAME, []); | |
| 68 | + $notices = get_option(self::OPTION_NAME, []); | |
| 69 | 69 | $payload = ['status' => $status, 'message' => $message]; |
| 70 | 70 | if ($unique) { |
| 71 | 71 | if ($key && isset($notices[$key])) { |
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | - if (\in_array(['status' => $status, 'message' => $message], $notices, \true)) { | |
| 74 | + if (in_array(['status' => $status, 'message' => $message], $notices, \true)) { | |
| 75 | 75 | return; |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | if ($key) { |
| @@ -79,9 +79,9 @@ | ||
| 79 | 79 | $notices[$key] = $payload; |
| 80 | 80 | } else { |
| 81 | 81 | $notices[] = $payload; |
| 82 | 82 | } |
| 83 | - \update_option(self::OPTION_NAME, $notices); | |
| 83 | + update_option(self::OPTION_NAME, $notices); | |
| 84 | 84 | } |
| 85 | 85 | /** |
| 86 | 86 | * Add bulk notices. |
| 87 | 87 | * |
| @@ -86,15 +86,15 @@ | ||
| 86 | 86 | * Add bulk notices. |
| 87 | 87 | * |
| 88 | 88 | * @param string|array $messages a message or an array of messages to add. |
| 89 | 89 | */ |
| 90 | - public static function adds(string $status, $messages) : void | |
| 90 | + public static function adds(string $status, $messages): void | |
| 91 | 91 | { |
| 92 | - if (!\is_array($messages)) { | |
| 92 | + if (!is_array($messages)) { | |
| 93 | 93 | $messages = [$messages]; |
| 94 | 94 | } |
| 95 | 95 | foreach ($messages as $message) { |
| 96 | - if (!\is_array($message)) { | |
| 96 | + if (!is_array($message)) { | |
| 97 | 97 | self::add($status, $message); |
| 98 | 98 | } else { |
| 99 | 99 | self::add($status, ...$message); |
| 100 | 100 | } |
| @@ -99,21 +99,21 @@ | ||
| 99 | 99 | self::add($status, ...$message); |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | - public static function success(string $message, ?string $key = null, bool $unique = \false) : void | |
| 103 | + public static function success(string $message, ?string $key = null, bool $unique = \false): void | |
| 104 | 104 | { |
| 105 | - self::add(self::SUCCESS, ...\func_get_args()); | |
| 105 | + self::add(self::SUCCESS, ...func_get_args()); | |
| 106 | 106 | } |
| 107 | - public static function warning(string $message, ?string $key = null, bool $unique = \false) : void | |
| 107 | + public static function warning(string $message, ?string $key = null, bool $unique = \false): void | |
| 108 | 108 | { |
| 109 | - self::add(self::WARNING, ...\func_get_args()); | |
| 109 | + self::add(self::WARNING, ...func_get_args()); | |
| 110 | 110 | } |
| 111 | - public static function info(string $message, ?string $key = null, bool $unique = \false) : void | |
| 111 | + public static function info(string $message, ?string $key = null, bool $unique = \false): void | |
| 112 | 112 | { |
| 113 | - self::add(self::INFO, ...\func_get_args()); | |
| 113 | + self::add(self::INFO, ...func_get_args()); | |
| 114 | 114 | } |
| 115 | - public static function error(string $message, ?string $key = null, bool $unique = \false) : void | |
| 115 | + public static function error(string $message, ?string $key = null, bool $unique = \false): void | |
| 116 | 116 | { |
| 117 | - self::add(self::ERROR, ...\func_get_args()); | |
| 117 | + self::add(self::ERROR, ...func_get_args()); | |
| 118 | 118 | } |
| 119 | 119 | } |