', esc_attr(self::MESSAGE_COMPOSE_ID), esc_attr(self::MESSAGE_COMPOSE_ID), $open ? ' data-jio-dialog-autoopen' : '' ); echo '
__('最多输入 {count} 字。', 'jio'), 'role-hint' => __('将发送给 {count} 位用户;提交前需再次确认。', 'jio'), 'role-title' => __('确认按角色群发', 'jio'), 'role-confirm' => __('将向「{role}」的 {count} 位用户发送系统消息,并按通知配置触发提醒。请确认收件人范围与消息内容。', 'jio'), 'role-send' => __('确认发送', 'jio'), ]; foreach ($strings as $key => $text) { echo ' data-i18n-' . esc_attr($key) . '="' . esc_attr($text) . '"'; } echo '>'; echo ''; echo ''; wp_nonce_field('jio_users_send_message'); $this->render_message_dialog_head(self::MESSAGE_COMPOSE_ID, __('发送系统消息', 'jio'), 'dashicons-megaphone'); echo '
'; if ($open) { $error = sanitize_text_field((string) wp_unslash($_GET['jio_msg_error'] ?? __('消息发送失败,请检查后重试。', 'jio'))); echo '

' . esc_html($error) . '

'; } echo '
' . esc_html__('收件人', 'jio') . ''; foreach (['users' => [__('指定用户', 'jio'), 'dashicons-admin-users'], 'role' => [__('按角色群发', 'jio'), 'dashicons-groups']] as $value => [$label, $icon]) { echo ''; } echo '
'; printf( '', esc_html__('用户', 'jio'), esc_attr__('用户 ID / 用户名 / 邮箱,逗号或换行分隔', 'jio'), esc_html(sprintf(__('单次最多 %d 位。', 'jio'), AdminBroadcast::MAX_USERS)) ); echo ''; printf( '', esc_html__('标题', 'jio'), AdminBroadcast::TITLE_MAX, esc_attr__('留空则取内容开头', 'jio') ); echo ''; printf( '', esc_html__('内容', 'jio'), AdminBroadcast::CONTENT_MAX ); echo '

' . esc_html__('以「系统通知」类型逐人投递;邮件 / 公众号提醒按通知配置同步触发。', 'jio') . '

'; echo '
'; } private function render_message_dialogs(): void { echo '
'; $this->render_message_dialog_head('jio-msg-detail', __('消息详情', 'jio'), 'dashicons-email-alt'); echo '
'; echo '
'; echo ' __('删除消息', 'jio'), 'delete-text' => __('确定删除 {count} 条消息?删除后用户收件箱中也将不再显示,此操作不可撤销。', 'jio'), 'delete-send' => __('确认删除', 'jio'), ] as $key => $text) { echo ' data-i18n-' . esc_attr($key) . '="' . esc_attr($text) . '"'; } echo '>
'; $this->render_message_dialog_head('jio-msg-confirm', __('确认操作', 'jio'), 'dashicons-warning'); echo '

'; echo '
'; } private function render_message_dialog_head(string $id, string $title, string $icon): void { echo '

'; echo '' . esc_html($title) . '

'; echo '
'; } }