fix(float): inline panel warnings, drop add-button type picker, mirror reference more-button defaults

This commit is contained in:
kate522 committed 2026-09-26 21:01:55 +08:00
1 parent 6f2adfaef1
commit eb14c4afd3
5 files changed
+106 -92

No files matched your search

+9 -22
View File
@@ -71,41 +71,27 @@ endif;
if (!function_exists('aksrt_get_float_add_html')) :
/**
* 发布按钮:单项直接链接;多项 hover 下拉 .drop-newadd。
*
* @param string[] $types
* 发布按钮:当前仅文章投稿,对应参考主题单按钮分支(直接链接)。
*/
function aksrt_get_float_add_html(array $types, string $icon, string $style): string {
if (!$types || !function_exists('aksrt_get_new_add_actions')) {
function aksrt_get_float_add_html(string $icon, string $style, bool $is_mobile): string {
if (!function_exists('aksrt_get_new_add_actions')) {
return '';
}
if (class_exists('\AKSRT\Settings\Settings') && \AKSRT\Settings\Settings::close_sign()) {
return '';
}
$actions = aksrt_get_new_add_actions($types);
$actions = aksrt_get_new_add_actions(['post']);
if (!$actions) {
return '';
}
$a = $actions[0];
$icon_html = $icon !== '' ? aksrt_icon_markup($icon) : '';
if ($icon_html === '') {
$icon_html = '<i class="fa fas fa-plus" aria-hidden="true"></i>';
}
if (count($actions) === 1) {
$a = $actions[0];
return '<a' . $style . ' rel="nofollow" class="newadd-btns float-btn add-btn" title="' . esc_attr($a['label']) . '" href="' . esc_url($a['url']) . '">' . $icon_html . '</a>';
}
$btns = '';
foreach ($actions as $a) {
$btns .= '<a rel="nofollow" class="btn-newadd" href="' . esc_url($a['url']) . '">'
. '<icon class="jb-green">' . aksrt_icon_markup((string) $a['icon']) . '</icon>'
. '<text>' . esc_html($a['label']) . '</text></a>';
}
return '<span' . $style . ' class="newadd-btns hover-show float-btn add-btn">' . $icon_html
. '<div class="hover-show-con dropdown-menu drop-newadd">' . $btns . '</div></span>';
return '<a' . $style . ' rel="nofollow" class="newadd-btns float-btn add-btn"' . aksrt_float_btn_tooltip_attr((string) $a['label'], $is_mobile) . ' href="' . esc_url($a['url']) . '">' . $icon_html . '</a>';
}
endif;
@@ -185,7 +171,7 @@ if (!function_exists('aksrt_float_right')) :
switch ($type) {
case 'theme_mode':
$btn .= '<a' . $style . ' class="float-btn toggle-theme hover-show"' . aksrt_float_btn_tooltip_attr(__('切换主题', 'aksrt'), $is_mobile) . ' href="javascript:;"><i class="fa fa-toggle-theme"></i></a>';
$btn .= '<a' . $style . ' class="float-btn toggle-theme hover-show"' . aksrt_float_btn_tooltip_attr(__('切换主题', 'aksrt'), $is_mobile) . ' href="javascript:;"><i class="fa fas fa-toggle-theme"></i></a>';
break;
case 'back_top':
@@ -224,7 +210,8 @@ if (!function_exists('aksrt_float_right')) :
break;
case 'add':
$btn .= aksrt_get_float_add_html((array) ($opt['btns'] ?? []), (string) ($opt['icon'] ?? ''), $style);
// 当前仅支持文章投稿,发布类型固定为 post。
$btn .= aksrt_get_float_add_html((string) ($opt['icon'] ?? ''), $style, $is_mobile);
break;
case 'more':