103 lines
5.5 KiB
PHP
103 lines
5.5 KiB
PHP
<?php if ( ! defined( 'ABSPATH' ) ) exit;
|
||
$is_edit = isset( $wiki ) && $wiki;
|
||
$page_title = $is_edit ? 'Wiki bearbeiten' : 'Neues Wiki erstellen';
|
||
$wiki_id = $is_edit ? $wiki->ID : 0;
|
||
$wiki_title = $is_edit ? $wiki->post_title : '';
|
||
$wiki_desc = $is_edit ? $wiki->post_content : '';
|
||
$wiki_excerpt= $is_edit ? $wiki->post_excerpt : '';
|
||
$wiki_icon = $is_edit ? get_post_meta($wiki_id,'_wmw_icon',true) : '📖';
|
||
$wiki_color = $is_edit ? get_post_meta($wiki_id,'_wmw_color',true) : '#2271b1';
|
||
$wiki_ver = $is_edit ? get_post_meta($wiki_id,'_wmw_version',true) : '1.0.0';
|
||
$wiki_status = $is_edit ? $wiki->post_status : 'publish';
|
||
?>
|
||
<div class="wrap wmw-admin-wrap">
|
||
<div class="wmw-admin-header wmw-admin-header--small">
|
||
<div class="wmw-admin-header__logo">
|
||
<span class="wmw-admin-header__icon">📝</span>
|
||
<div>
|
||
<h1><?php echo esc_html($page_title); ?></h1>
|
||
<p><?php echo $is_edit ? 'Passe dein Wiki an.' : 'Lege ein neues Wiki für dein Plugin an.'; ?></p>
|
||
</div>
|
||
</div>
|
||
<a href="<?php echo admin_url('admin.php?page=wp-multi-wiki'); ?>" class="button">← Zurück</a>
|
||
</div>
|
||
|
||
<div class="wmw-form-layout">
|
||
<div class="wmw-form-main">
|
||
<div class="wmw-card">
|
||
<div class="wmw-field">
|
||
<label for="wmw_title" class="wmw-label">Wiki-Name <span class="required">*</span></label>
|
||
<input type="text" id="wmw_title" name="wmw_title" class="large-text" value="<?php echo esc_attr($wiki_title); ?>" placeholder="z.B. My Awesome Plugin">
|
||
</div>
|
||
<div class="wmw-field">
|
||
<label for="wmw_excerpt" class="wmw-label">Kurzbeschreibung</label>
|
||
<input type="text" id="wmw_excerpt" name="wmw_excerpt" class="large-text" value="<?php echo esc_attr($wiki_excerpt); ?>" placeholder="Kurze Beschreibung des Plugins…">
|
||
</div>
|
||
<div class="wmw-field">
|
||
<label class="wmw-label">Beschreibung / Intro-Text</label>
|
||
<?php
|
||
wp_editor( $wiki_desc, 'wmw_description', array(
|
||
'textarea_name' => 'wmw_description',
|
||
'media_buttons' => false,
|
||
'textarea_rows' => 8,
|
||
'tinymce' => true,
|
||
) );
|
||
?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="wmw-form-sidebar">
|
||
<div class="wmw-card">
|
||
<h3 class="wmw-card__title">🎨 Erscheinungsbild</h3>
|
||
<div class="wmw-field">
|
||
<label class="wmw-label">Icon (Emoji)</label>
|
||
<input type="text" id="wmw_icon" name="wmw_icon" value="<?php echo esc_attr($wiki_icon); ?>" style="font-size:24px;width:80px;text-align:center;">
|
||
<p class="description">Ein Emoji-Icon für dein Wiki</p>
|
||
<div class="wmw-emoji-picker">
|
||
<?php $emojis = ['📖','📚','🔌','⚙️','🛠️','💡','🚀','🔧','📦','🎯','🔑','📊','🖥️','💻','📝','🌐','🔒','⚡','🎮','📱'];
|
||
foreach($emojis as $e): ?>
|
||
<button type="button" class="wmw-emoji-btn" data-emoji="<?php echo $e; ?>"><?php echo $e; ?></button>
|
||
<?php endforeach; ?>
|
||
</div>
|
||
</div>
|
||
<div class="wmw-field">
|
||
<label class="wmw-label">Akzentfarbe</label>
|
||
<input type="text" id="wmw_color" name="wmw_color" value="<?php echo esc_attr($wiki_color); ?>" class="wmw-color-picker">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="wmw-card">
|
||
<h3 class="wmw-card__title">⚙️ Plugin-Info</h3>
|
||
<div class="wmw-field">
|
||
<label class="wmw-label">Plugin-Version</label>
|
||
<input type="text" name="wmw_version" value="<?php echo esc_attr($wiki_ver); ?>" class="regular-text" placeholder="1.0.0">
|
||
</div>
|
||
<div class="wmw-field">
|
||
<label class="wmw-label">Status</label>
|
||
<select name="wmw_status" class="regular-text">
|
||
<option value="publish" <?php selected($wiki_status,'publish'); ?>>✅ Veröffentlicht</option>
|
||
<option value="draft" <?php selected($wiki_status,'draft'); ?>>📝 Entwurf</option>
|
||
<option value="private" <?php selected($wiki_status,'private'); ?>>🔒 Privat</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="wmw-card">
|
||
<button type="button" id="wmw-save-wiki" class="button button-primary button-large wmw-btn-full"
|
||
data-id="<?php echo $wiki_id; ?>">
|
||
<?php echo $is_edit ? '💾 Wiki speichern' : '🚀 Wiki erstellen'; ?>
|
||
</button>
|
||
<?php if ( $is_edit ) : ?>
|
||
<a href="<?php echo get_permalink($wiki_id); ?>" target="_blank" class="button button-large wmw-btn-full wmw-mt-sm">
|
||
🔗 Im Frontend ansehen
|
||
</a>
|
||
<a href="<?php echo admin_url('admin.php?page=wmw-new-article&wiki_id='.$wiki_id); ?>" class="button wmw-btn-full wmw-mt-sm">
|
||
➕ Artikel hinzufügen
|
||
</a>
|
||
<?php endif; ?>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|