138 lines
5.4 KiB
PHP
138 lines
5.4 KiB
PHP
<?php
|
|
/**
|
|
* Main column: cover + title + editor + status.
|
|
*
|
|
* @var array $ctx
|
|
* @package AKSRT
|
|
*/
|
|
defined('ABSPATH') || exit;
|
|
|
|
$settings = $ctx['settings'];
|
|
$edit_post = $ctx['edit_post'];
|
|
$is_can_new = !empty($ctx['is_can_new']);
|
|
?>
|
|
<div class="aksrt-submit-main">
|
|
<div class="aksrt-submit-panel aksrt-submit-panel--editor">
|
|
<?php
|
|
$featured_path = get_template_directory() . '/templates/parts/submit/featured.php';
|
|
if (file_exists($featured_path)) {
|
|
include $featured_path;
|
|
}
|
|
?>
|
|
|
|
<div class="aksrt-submit-title-wrap">
|
|
<textarea
|
|
name="post_title"
|
|
id="submit-title"
|
|
class="aksrt-submit-title"
|
|
rows="1"
|
|
maxlength="<?php echo esc_attr((string) ((int) ($settings['title_max'] ?? 30) * 4)); ?>"
|
|
placeholder="<?php echo esc_attr((string) ($settings['title_placeholder'] ?? __('请输入标题', 'aksrt'))); ?>"
|
|
data-auto-height
|
|
data-max-height="<?php echo wp_is_mobile() ? '110' : '78'; ?>"
|
|
><?php echo esc_textarea((string) $ctx['current_title']); ?></textarea>
|
|
</div>
|
|
|
|
<?php if (!$is_can_new) : ?>
|
|
<div class="aksrt-submit-nocan">
|
|
<div class="aksrt-submit-nocan__icon"><i class="fa fas fa-lock"></i></div>
|
|
<p><?php esc_html_e('无法发布', 'aksrt'); ?></p>
|
|
<p class="muted"><?php esc_html_e('你当前没有前台投稿权限,请联系管理员开通。', 'aksrt'); ?></p>
|
|
</div>
|
|
<?php else : ?>
|
|
<div class="aksrt-submit-editor-wrap">
|
|
<?php
|
|
$initial_content = (string) $ctx['current_content'];
|
|
if ($initial_content !== '') :
|
|
?>
|
|
<textarea id="aksrt-initial-post-content" hidden aria-hidden="true" tabindex="-1"><?php echo esc_textarea($initial_content); ?></textarea>
|
|
<?php
|
|
endif;
|
|
$toolbar1 = 'formatselect,bold,italic,bullist,numlist,alignleft,aligncenter,alignright,link,blockquote,code,fullscreen';
|
|
$plugins = 'paste,link,lists,fullscreen,wordpress,wplink,charmap';
|
|
$editor_settings = [
|
|
'textarea_name' => 'post_content',
|
|
'textarea_rows' => 20,
|
|
'editor_height' => wp_is_mobile() ? 460 : 470,
|
|
'media_buttons' => false,
|
|
'default_editor' => 'tinymce',
|
|
'quicktags' => true,
|
|
'teeny' => false,
|
|
'tinymce' => [
|
|
'toolbar1' => $toolbar1,
|
|
'toolbar2' => 'fontsizeselect,forecolor,removeformat,undo,redo,wp_help',
|
|
'plugins' => $plugins,
|
|
'placeholder' => (string) ($settings['content_placeholder'] ?? ''),
|
|
],
|
|
];
|
|
wp_editor($initial_content, 'post_content', $editor_settings);
|
|
?>
|
|
</div>
|
|
|
|
<?php if (!empty($ctx['can_hide']) || !empty($ctx['can_pay']) || !empty($ctx['can_upload_img'])) : ?>
|
|
<div class="aksrt-submit-shortcode-tools">
|
|
<?php if (!empty($ctx['can_upload_img'])) : ?>
|
|
<button type="button" class="but" data-insert-upload-image>
|
|
<i class="fa fas fa-image"></i> <?php esc_html_e('上传图片', 'aksrt'); ?>
|
|
</button>
|
|
<?php endif; ?>
|
|
<?php if (!empty($ctx['can_hide'])) : ?>
|
|
<button type="button" class="but" data-insert-shortcode="hide" title="<?php esc_attr_e('插入登录后可见', 'aksrt'); ?>">
|
|
<i class="fa fas fa-eye-slash"></i> <?php esc_html_e('登录可见', 'aksrt'); ?>
|
|
</button>
|
|
<button type="button" class="but" data-insert-shortcode="reply" title="<?php esc_attr_e('插入回复后可见', 'aksrt'); ?>">
|
|
<i class="fa fas fa-comment-dots"></i> <?php esc_html_e('回复可见', 'aksrt'); ?>
|
|
</button>
|
|
<button type="button" class="but" data-insert-shortcode="vip" title="<?php esc_attr_e('插入 VIP 可见', 'aksrt'); ?>">
|
|
<i class="fa fas fa-certificate"></i> <?php esc_html_e('VIP 可见', 'aksrt'); ?>
|
|
</button>
|
|
<?php endif; ?>
|
|
<?php if (!empty($ctx['can_pay'])) : ?>
|
|
<button type="button" class="but" data-insert-shortcode="payshow" title="<?php esc_attr_e('插入付费可见内容', 'aksrt'); ?>">
|
|
<i class="fa fas fa-lock"></i> <?php esc_html_e('付费可见', 'aksrt'); ?>
|
|
</button>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
|
|
<div class="aksrt-submit-status-row">
|
|
<span class="aksrt-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('预览文章', 'aksrt'); ?>
|
|
</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('后台编辑', 'aksrt'); ?>
|
|
</a>
|
|
<?php endif; ?>
|
|
<?php elseif (!empty($ctx['draft_count']) && $ctx['user_id'] > 0) : ?>
|
|
<?php
|
|
$draft_url = function_exists('aksrt_get_user_center_url')
|
|
? add_query_arg('post_status', 'draft', aksrt_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 篇草稿 点击查看', 'aksrt'),
|
|
(int) $ctx['draft_count']
|
|
);
|
|
?>
|
|
<i class="fa fas fa-angle-right"></i>
|
|
</a>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
</span>
|
|
<span class="aksrt-submit-modified-time">
|
|
<?php if (!empty($ctx['post_modified'])) : ?>
|
|
<span class="badg"><?php echo esc_html(sprintf(__('最后保存:%s', 'aksrt'), $ctx['post_modified'])); ?></span>
|
|
<?php endif; ?>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|