The theme was renamed Zibll/子比 → AKSRT → Jio, but upstream branding survived the sweeps in CSS classes, the SVG sprite prefix, a persisted widget field ID, JS events, admin Vue class names, test infrastructure and docblocks. Renames: - zib-widget / zib-widget-wrap / zib-slider → jio-widget-box / jio-widget-box-wrap / jio-slider-box (jio-widget is taken by the modern widget shell, jio-box-* by the card primitives) - zib-partners-scroll + zps-* → jio-partners-scroll + jps-* - zib-combo-info-card + zci-* → jio-combo-info-card + jci-* - zibsvg- → jiosvg-, including the exported picker helpers and the fa-zibsvg- family-prefix guard - zibpay_type → pay_type; the dual-read fallback in PostQuery collapses to a single key - [zibajax="submit"] dropped (no PHP emitter); zib_ajax.success → jio_ajax.success - aks-* admin Vue classes → jio-* - zib_palette() → palette() User-facing vendor traces are gone: the floating "more" button default no longer ships a zibll.com link or 子比主题 marketing copy, the notice widget ships no preset promo entries, and the four 官网教程 links are removed from the post-list admin schema. Test infrastructure renamed to neutral names (docker-compose.reference.yml, Caddyfile, article-baseline.json, modern-widgets-contract.test.cjs) with their DB/volume/env/slug identifiers following. Kept intentionally, documented in tests/fixtures/README.md: the golden fixture reference fingerprint (a SHA-256 record of an external directory, read by validate-widget-golden / generate-widget-golden-fixture / audit-widget-system), the doesNotMatch guards that prove the old tokens are gone, and the reference theme's own meta key in the visual fixtures. No backward-compat or data migration: saved widget configs holding old icon keys or the old field ID silently lose them, per the project's rewrite-over-compatibility rule. Verified: 132/132 node contract tests, php tests/widget-system/run.php (146 assertions), audit-admin-contracts, audit-psr4-paths and validate-widget-golden all green; tracked bundles regenerated and in sync. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
140 lines
5.4 KiB
PHP
140 lines
5.4 KiB
PHP
<?php
|
|
/**
|
|
* Main column: cover + title + editor + status.
|
|
*
|
|
* @var array $ctx
|
|
* @package Jio
|
|
*/
|
|
defined('ABSPATH') || exit;
|
|
|
|
$settings = $ctx['settings'];
|
|
$edit_post = $ctx['edit_post'];
|
|
$is_can_new = !empty($ctx['is_can_new']);
|
|
?>
|
|
<div class="jio-widget-box full-widget-sm editor-main-box" style="min-height:60vh;">
|
|
<?php
|
|
$featured_path = get_template_directory() . '/templates/parts/submit/featured.php';
|
|
if (file_exists($featured_path)) {
|
|
include $featured_path;
|
|
}
|
|
?>
|
|
|
|
<div class="relative newposts-title">
|
|
<textarea
|
|
name="post_title"
|
|
id="submit-title"
|
|
class="line-form-input input-lg new-title"
|
|
tabindex="1"
|
|
rows="1"
|
|
maxlength="<?php echo esc_attr((string) ((int) ($settings['title_max'] ?? 30) * 4)); ?>"
|
|
placeholder="<?php echo esc_attr((string) ($settings['title_placeholder'] ?? __('请输入标题', 'jio'))); ?>"
|
|
data-auto-height
|
|
data-max-height="<?php echo wp_is_mobile() ? '110' : '78'; ?>"
|
|
><?php echo esc_textarea((string) $ctx['current_title']); ?></textarea>
|
|
<i class="line-form-line"></i>
|
|
</div>
|
|
|
|
<?php if (!$is_can_new) : ?>
|
|
<div class="flex jc newposts-nocan" style="min-height:50vh;">
|
|
<div class="text-center"><div><i class="fa fas fa-lock"></i></div>
|
|
<p><?php esc_html_e('无法发布', 'jio'); ?></p>
|
|
<p class="muted-color"><?php esc_html_e('你当前没有前台投稿权限,请联系管理员开通。', 'jio'); ?></p></div>
|
|
</div>
|
|
<?php else : ?>
|
|
<div class="newposts-editor">
|
|
<?php
|
|
$toolbar1 = ['formatselect', 'bold', 'italic', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'link'];
|
|
if (!empty($ctx['can_upload_img'])) {
|
|
$toolbar1[] = 'jio_image';
|
|
}
|
|
$toolbar1[] = 'jio_video';
|
|
if (!empty($ctx['can_upload_file'])) {
|
|
$toolbar1[] = 'jio_file';
|
|
}
|
|
if (!empty($ctx['can_hide'])) {
|
|
$toolbar1[] = 'jio_hide';
|
|
}
|
|
$toolbar1 = implode(',', array_merge($toolbar1, ['jio_quote', 'jio_precode', 'fullscreen', 'wp_adv']));
|
|
$plugins = 'paste,link,lists,fullscreen,wordpress,wplink,charmap,colorpicker,textcolor';
|
|
$editor_plugin_path = get_template_directory() . '/assets/js/front-submit-editor.js';
|
|
$editor_plugin_url = get_template_directory_uri() . '/assets/js/front-submit-editor.js';
|
|
if (file_exists($editor_plugin_path)) {
|
|
$editor_plugin_url = add_query_arg('ver', (string) filemtime($editor_plugin_path), $editor_plugin_url);
|
|
}
|
|
$editor_css_path = get_template_directory() . '/assets/css/frontend/pages/submit-editor.css';
|
|
$editor_css_url = get_template_directory_uri() . '/assets/css/frontend/pages/submit-editor.css';
|
|
if (file_exists($editor_css_path)) {
|
|
$editor_css_url = add_query_arg('ver', (string) filemtime($editor_css_path), $editor_css_url);
|
|
}
|
|
$external_plugins = static function (array $external, string $editor_id) use ($editor_plugin_url): array {
|
|
if ($editor_id === 'post_content') {
|
|
$external['jio_editor_tools'] = $editor_plugin_url;
|
|
}
|
|
return $external;
|
|
};
|
|
$editor_content_css = static function (string $styles) use ($editor_css_url): string {
|
|
return $styles . ($styles !== '' ? ',' : '') . $editor_css_url;
|
|
};
|
|
add_filter('mce_external_plugins', $external_plugins, 10, 2);
|
|
add_filter('mce_css', $editor_content_css);
|
|
$editor_settings = [
|
|
'textarea_name' => 'post_content',
|
|
'textarea_rows' => 20,
|
|
'editor_height' => wp_is_mobile() ? 460 : 470,
|
|
'media_buttons' => false,
|
|
'default_editor' => 'tinymce',
|
|
'quicktags' => false,
|
|
'teeny' => false,
|
|
'tinymce' => [
|
|
'toolbar1' => $toolbar1,
|
|
'toolbar2' => 'fontsizeselect,forecolor,removeformat,undo,redo,wp_help',
|
|
'plugins' => $plugins,
|
|
'placeholder' => (string) ($settings['content_placeholder'] ?? ''),
|
|
],
|
|
];
|
|
wp_editor((string) $ctx['current_content'], 'post_content', $editor_settings);
|
|
remove_filter('mce_external_plugins', $external_plugins, 10);
|
|
remove_filter('mce_css', $editor_content_css, 10);
|
|
?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="flex ac jsb mt10">
|
|
<span class="view-btn jio-submit-view-btn">
|
|
<?php if ($edit_post) : ?>
|
|
<a class="but c-blue" target="_blank" href="<?php echo esc_url(get_permalink($edit_post)); ?>">
|
|
<i class="fa fas fa-file-alt"></i> <?php esc_html_e('预览文章', 'jio'); ?>
|
|
</a>
|
|
<?php if (current_user_can('manage_options')) : ?>
|
|
<a class="but c-yellow" href="<?php echo esc_url(get_edit_post_link($edit_post)); ?>">
|
|
<?php esc_html_e('后台编辑', 'jio'); ?>
|
|
</a>
|
|
<?php endif; ?>
|
|
<?php elseif (!empty($ctx['draft_count']) && $ctx['user_id'] > 0) : ?>
|
|
<?php
|
|
$draft_url = function_exists('jio_get_user_center_url')
|
|
? add_query_arg('post_status', 'draft', jio_get_user_center_url('posts'))
|
|
: '';
|
|
?>
|
|
<?php if ($draft_url !== '') : ?>
|
|
<a class="but" target="_blank" href="<?php echo esc_url($draft_url); ?>">
|
|
<?php
|
|
printf(
|
|
/* translators: %d: draft count */
|
|
esc_html__('您已有 %d 篇草稿 点击查看', 'jio'),
|
|
(int) $ctx['draft_count']
|
|
);
|
|
?>
|
|
<i class="fa fas fa-angle-right"></i>
|
|
</a>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
</span>
|
|
<span class="modified-time jio-submit-modified-time">
|
|
<?php if (!empty($ctx['post_modified'])) : ?>
|
|
<span class="badg"><?php echo esc_html(sprintf(__('最后保存:%s', 'jio'), $ctx['post_modified'])); ?></span>
|
|
<?php endif; ?>
|
|
</span>
|
|
</div>
|
|
</div>
|