'avatar']); if ($placeholder === '') { $placeholder = __('说点什么吧...', 'aksrt'); } $html = '
'; $html .= '
'; $html .= $avatar; $html .= '
' . esc_html($placeholder) . '
'; $html .= '
'; $html .= '' . esc_html__('提交', 'aksrt') . ''; $html .= '
'; return $html; } endif; if (!function_exists('aksrt_get_input_expand_but')) : /** * legacy-style expand toolbar button + dropdown (legacy: legacy). * * @param string $type code|image|link. * @param mixed $arg1 Type-specific arg. * @param array $ctx Optional context (upload). * @return string */ function aksrt_get_input_expand_but(string $type, $arg1 = null, array $ctx = []): string { $but = ''; $dropdown = ''; switch ($type) { case 'link': $but = '' . esc_html__('链接', 'aksrt') . ''; $dropdown = ''; break; case 'code': $but = '' . esc_html__('代码', 'aksrt') . ''; $dropdown = ''; break; case 'image': $upload = !empty($arg1) || !empty($ctx['upload']); $upload_id = 'comment'; $but = '' . esc_html__('图片', 'aksrt') . ''; $dropdown = '
'; $dropdown .= ''; if ($upload) { $placeholder = get_template_directory_uri() . '/assets/icons/upload-add.svg'; $dropdown .= ''; } $dropdown .= '
'; break; default: return ''; } $con = $but . ''; return '' . $con . ''; } endif; if (!function_exists('aksrt_render_comment_expand_toolbar')) : /** * Render left-side expand tools based on settings (legacy order: code/image/link). * * @param array $ctx Comments context. */ function aksrt_render_comment_expand_toolbar(array $ctx): void { $toolbar = is_array($ctx['toolbar'] ?? null) ? $ctx['toolbar'] : []; $upload = !empty($ctx['upload_enabled']); $link_s = !empty($ctx['link_enabled']); if (!empty($toolbar['code'])) { echo aksrt_get_input_expand_but('code'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } if (!empty($toolbar['image'])) { echo aksrt_get_input_expand_but('image', $upload, ['upload' => $upload]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } if ($link_s) { echo aksrt_get_input_expand_but('link'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } endif;