new file: olm-login.php
This commit is contained in:
@@ -4,6 +4,14 @@ defined('ABSPATH') || exit;
|
||||
$active_product_slug = (string) ($active_product_slug ?? '');
|
||||
$active_version_slug = (string) ($active_version_slug ?? '');
|
||||
$active_page_slug = (string) ($active_page_slug ?? '');
|
||||
$active_product = is_array($active_product ?? null) ? $active_product : null;
|
||||
$active_page_link_slugs = (array) ($active_page_link_slugs ?? []);
|
||||
$products_by_category = [];
|
||||
|
||||
foreach ((array) $products as $item) {
|
||||
$category = trim((string) ($item['category'] ?? ''));
|
||||
$products_by_category[$category ?: __('Weitere Produkte', 'kb-markdown-importer')][] = $item;
|
||||
}
|
||||
?>
|
||||
<div class="kb-docs-wrap kb-docs-app">
|
||||
<aside class="kb-app-sidebar" aria-label="<?php esc_attr_e('Dokumentationsnavigation', 'kb-markdown-importer'); ?>">
|
||||
@@ -13,31 +21,49 @@ $active_page_slug = (string) ($active_page_slug ?? '');
|
||||
<div class="kb-app-sidebar__search">
|
||||
<?php echo do_shortcode('[kb_search]'); ?>
|
||||
</div>
|
||||
<?php if ($active_product && $active_version_slug && ! empty($active_pages)) : ?>
|
||||
<section class="kb-app-active-nav" aria-label="<?php esc_attr_e('Aktive Dokumentation', 'kb-markdown-importer'); ?>">
|
||||
<a class="kb-app-active-nav__title" href="<?php echo esc_url($url_builder::version($active_product_slug, $active_version_slug)); ?>">
|
||||
<?php echo esc_html((string) $active_product['term']->name); ?>
|
||||
</a>
|
||||
<ul class="kb-app-page-list">
|
||||
<?php foreach ((array) $active_pages as $page) : ?>
|
||||
<?php
|
||||
$linkSlug = (string) ($active_page_link_slugs[$page->ID] ?? get_post_meta($page->ID, '_kb_page_slug', true));
|
||||
$isActivePage = $linkSlug === $active_page_slug || ('' === $active_page_slug && in_array($linkSlug, ['', 'index'], true));
|
||||
$sourceSlug = (string) get_post_meta($page->ID, '_kb_product_slug', true);
|
||||
$part = (array) (($active_product['parts'][$sourceSlug] ?? []) ?: []);
|
||||
?>
|
||||
<li class="<?php echo $isActivePage ? 'is-active' : ''; ?>">
|
||||
<a href="<?php echo esc_url($url_builder::page($active_product_slug, $active_version_slug, $linkSlug)); ?>">
|
||||
<?php if (! empty($part['label']) && count((array) $active_product['parts']) > 1) : ?>
|
||||
<span class="kb-app-page-list__part"><?php echo esc_html((string) $part['label']); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php echo esc_html(get_the_title($page)); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
<nav class="kb-app-nav">
|
||||
<?php foreach ((array) $products as $item) : ?>
|
||||
<?php
|
||||
$term = $item['term'];
|
||||
$versions = (array) $item['versions'];
|
||||
$latest = $versions[0] ?? null;
|
||||
$isActiveProduct = $term->slug === $active_product_slug;
|
||||
?>
|
||||
<section class="kb-app-product <?php echo $isActiveProduct ? 'is-active' : ''; ?>">
|
||||
<a class="kb-app-product__link" href="<?php echo esc_url($latest ? $url_builder::version($term->slug, $latest->slug) : $url_builder::product($term->slug)); ?>">
|
||||
<?php echo esc_html($term->name); ?>
|
||||
</a>
|
||||
<?php if ($isActiveProduct && $active_version_slug && ! empty($active_pages)) : ?>
|
||||
<ul class="kb-app-page-list">
|
||||
<?php foreach ((array) $active_pages as $page) : ?>
|
||||
<?php
|
||||
$pageSlug = (string) get_post_meta($page->ID, '_kb_page_slug', true);
|
||||
$isActivePage = $pageSlug === $active_page_slug || ('' === $active_page_slug && in_array($pageSlug, ['', 'index'], true));
|
||||
?>
|
||||
<li class="<?php echo $isActivePage ? 'is-active' : ''; ?>">
|
||||
<a href="<?php echo esc_url($url_builder::page($term->slug, $active_version_slug, $pageSlug)); ?>"><?php echo esc_html(get_the_title($page)); ?></a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<h2 class="kb-app-nav__title"><?php esc_html_e('Alle Produkte', 'kb-markdown-importer'); ?></h2>
|
||||
<?php foreach ($products_by_category as $category => $category_products) : ?>
|
||||
<section class="kb-app-category">
|
||||
<h3><?php echo esc_html((string) $category); ?></h3>
|
||||
<?php foreach ((array) $category_products as $item) : ?>
|
||||
<?php
|
||||
$term = $item['term'];
|
||||
$versions = (array) $item['versions'];
|
||||
$latest = $versions[0] ?? null;
|
||||
$isActiveProduct = $term->slug === $active_product_slug;
|
||||
?>
|
||||
<section class="kb-app-product <?php echo $isActiveProduct ? 'is-active' : ''; ?>">
|
||||
<a class="kb-app-product__link" href="<?php echo esc_url($latest ? $url_builder::version($term->slug, $latest->slug) : $url_builder::product($term->slug)); ?>">
|
||||
<?php echo esc_html($term->name); ?>
|
||||
</a>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
</nav>
|
||||
|
||||
@@ -3,6 +3,18 @@ defined('ABSPATH') || exit;
|
||||
|
||||
$settings = (array) ($settings ?? []);
|
||||
$updates = (array) ($updates ?? []);
|
||||
$updates_by_month = [];
|
||||
$products_by_category = [];
|
||||
|
||||
foreach ($updates as $update) {
|
||||
$month = (string) ($update['month_label'] ?? '');
|
||||
$updates_by_month[$month ?: ''][] = $update;
|
||||
}
|
||||
|
||||
foreach ((array) ($products ?? []) as $item) {
|
||||
$category = trim((string) ($item['category'] ?? ''));
|
||||
$products_by_category[$category ?: __('Weitere Produkte', 'kb-markdown-importer')][] = $item;
|
||||
}
|
||||
?>
|
||||
<section class="kb-docs-home">
|
||||
<h1><?php esc_html_e('Dokumentation', 'kb-markdown-importer'); ?></h1>
|
||||
@@ -16,38 +28,85 @@ $updates = (array) ($updates ?? []);
|
||||
<section class="kb-home-card kb-product-updates">
|
||||
<h2><?php esc_html_e('Neueste Produktupdates', 'kb-markdown-importer'); ?></h2>
|
||||
<?php if ($updates) : ?>
|
||||
<ul class="kb-product-updates__list">
|
||||
<?php foreach ($updates as $update) : ?>
|
||||
<li>
|
||||
<div class="kb-product-updates__meta">
|
||||
<strong><?php echo esc_html((string) ($update['product'] ?: __('Produkt', 'kb-markdown-importer'))); ?></strong>
|
||||
<?php if (! empty($update['version'])) : ?><span><?php echo esc_html((string) $update['version']); ?></span><?php endif; ?>
|
||||
<?php if (! empty($update['date'])) : ?><time><?php echo esc_html((string) $update['date']); ?></time><?php endif; ?>
|
||||
</div>
|
||||
<?php if (! empty($update['changelog'])) : ?>
|
||||
<p><?php echo esc_html((string) $update['changelog']); ?></p>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php foreach ($updates_by_month as $month => $month_updates) : ?>
|
||||
<section class="kb-product-updates__month">
|
||||
<?php if ('' !== $month) : ?><h3><?php echo esc_html($month); ?></h3><?php endif; ?>
|
||||
<ul class="kb-product-updates__list">
|
||||
<?php foreach ($month_updates as $update) : ?>
|
||||
<li>
|
||||
<div class="kb-product-updates__meta">
|
||||
<?php if (! empty($update['link'])) : ?>
|
||||
<strong><a href="<?php echo esc_url((string) $update['link']); ?>" target="_blank" rel="noopener"><?php echo esc_html((string) ($update['product'] ?: __('Produkt', 'kb-markdown-importer'))); ?></a></strong>
|
||||
<?php else : ?>
|
||||
<strong><?php echo esc_html((string) ($update['product'] ?: __('Produkt', 'kb-markdown-importer'))); ?></strong>
|
||||
<?php endif; ?>
|
||||
<?php if (! empty($update['version'])) : ?><span><?php echo esc_html((string) $update['version']); ?></span><?php endif; ?>
|
||||
<?php if (! empty($update['date'])) : ?><time><?php echo esc_html((string) $update['date']); ?></time><?php endif; ?>
|
||||
</div>
|
||||
<?php if (! empty($update['changelog_lines']) && is_array($update['changelog_lines'])) : ?>
|
||||
<ul class="kb-product-updates__changes">
|
||||
<?php foreach ($update['changelog_lines'] as $line) : ?>
|
||||
<li><?php echo esc_html((string) $line); ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php elseif (! empty($update['changelog'])) : ?>
|
||||
<p><?php echo esc_html((string) $update['changelog']); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if (! empty($update['starface_min']) || ! empty($update['starface_max']) || ! empty($update['link']) || ! empty($update['download_link'])) : ?>
|
||||
<dl class="kb-product-updates__details">
|
||||
<?php if (! empty($update['starface_min']) || ! empty($update['starface_max'])) : ?>
|
||||
<div>
|
||||
<dt><?php esc_html_e('STARFACE', 'kb-markdown-importer'); ?></dt>
|
||||
<dd><?php echo esc_html(trim((string) ($update['starface_min'] ?? '') . ' - ' . (string) ($update['starface_max'] ?? ''), ' -')); ?></dd>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (! empty($update['link'])) : ?>
|
||||
<div>
|
||||
<dt><?php esc_html_e('Dokumentation', 'kb-markdown-importer'); ?></dt>
|
||||
<dd><a href="<?php echo esc_url((string) $update['link']); ?>" target="_blank" rel="noopener"><?php echo esc_html((string) $update['link']); ?></a></dd>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if (! empty($update['download_link'])) : ?>
|
||||
<div>
|
||||
<dt><?php esc_html_e('Download', 'kb-markdown-importer'); ?></dt>
|
||||
<dd><a href="<?php echo esc_url((string) $update['download_link']); ?>" target="_blank" rel="noopener">get.o-byte.com</a></dd>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</dl>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php else : ?>
|
||||
<p class="kb-empty-state"><?php esc_html_e('Es wurden noch keine Produktupdates gefunden.', 'kb-markdown-importer'); ?></p>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
</div>
|
||||
<div class="kb-product-list">
|
||||
<?php foreach ((array) $products as $item) : ?>
|
||||
<?php $term = $item['term']; ?>
|
||||
<?php $latest = $item['versions'][0] ?? null; ?>
|
||||
<section class="kb-product-card">
|
||||
<h2><a href="<?php echo esc_url($latest ? $url_builder::version($term->slug, $latest->slug) : $url_builder::product($term->slug)); ?>"><?php echo esc_html($term->name); ?></a></h2>
|
||||
<?php if (! empty($item['versions'])) : ?>
|
||||
<ul>
|
||||
<?php foreach ($item['versions'] as $version) : ?>
|
||||
<li><a href="<?php echo esc_url($url_builder::version($term->slug, $version->slug)); ?>"><?php echo esc_html($version->name); ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<div class="kb-product-groups">
|
||||
<?php foreach ($products_by_category as $category => $category_products) : ?>
|
||||
<section class="kb-product-category">
|
||||
<h2><?php echo esc_html((string) $category); ?></h2>
|
||||
<div class="kb-product-list">
|
||||
<?php foreach ((array) $category_products as $item) : ?>
|
||||
<?php $term = $item['term']; ?>
|
||||
<?php $latest = $item['versions'][0] ?? null; ?>
|
||||
<section class="kb-product-card">
|
||||
<h3><a href="<?php echo esc_url($latest ? $url_builder::version($term->slug, $latest->slug) : $url_builder::product($term->slug)); ?>"><?php echo esc_html($term->name); ?></a></h3>
|
||||
<?php if (! empty($item['parts']) && count((array) $item['parts']) > 1) : ?>
|
||||
<p class="kb-product-card__parts"><?php echo esc_html(implode(', ', array_map(static fn (array $part): string => (string) $part['label'], (array) $item['parts']))); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if (! empty($item['versions'])) : ?>
|
||||
<ul>
|
||||
<?php foreach ($item['versions'] as $version) : ?>
|
||||
<li><a href="<?php echo esc_url($url_builder::version($term->slug, $version->slug)); ?>"><?php echo esc_html($version->name); ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
<?php
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
$product_item = is_array($product_item ?? null) ? $product_item : [];
|
||||
$parts = (array) ($product_item['parts'] ?? []);
|
||||
?>
|
||||
<section class="kb-docs-product">
|
||||
<nav class="kb-breadcrumbs"><a href="<?php echo esc_url($url_builder::docsIndex()); ?>"><?php esc_html_e('Dokumentation', 'kb-markdown-importer'); ?></a><span>/</span><?php echo esc_html($product->name); ?></nav>
|
||||
<h1><?php echo esc_html($product->name); ?></h1>
|
||||
<h2><?php esc_html_e('Verfügbare Versionen', 'kb-markdown-importer'); ?></h2>
|
||||
<?php if (count($parts) > 1) : ?>
|
||||
<p class="kb-product-parts"><?php echo esc_html(implode(', ', array_map(static fn (array $part): string => (string) $part['label'], $parts))); ?></p>
|
||||
<?php endif; ?>
|
||||
<h2><?php esc_html_e('Verfuegbare Versionen', 'kb-markdown-importer'); ?></h2>
|
||||
<ul class="kb-version-list">
|
||||
<?php foreach ((array) $versions as $index => $version) : ?>
|
||||
<li>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
defined('ABSPATH') || exit;
|
||||
$product_item = is_array($product_item ?? null) ? $product_item : [];
|
||||
$parts = (array) ($product_item['parts'] ?? []);
|
||||
$page_link_slugs = (array) ($page_link_slugs ?? []);
|
||||
?>
|
||||
<section class="kb-docs-version">
|
||||
<header class="kb-doc-header">
|
||||
@@ -26,8 +29,19 @@ defined('ABSPATH') || exit;
|
||||
</header>
|
||||
<ul class="kb-page-list">
|
||||
<?php foreach ((array) $pages as $page) : ?>
|
||||
<?php $slug = (string) get_post_meta($page->ID, '_kb_page_slug', true); ?>
|
||||
<li><a href="<?php echo esc_url($url_builder::page($product->slug, $version->slug, $slug)); ?>"><?php echo esc_html(get_the_title($page)); ?></a></li>
|
||||
<?php
|
||||
$slug = (string) ($page_link_slugs[$page->ID] ?? get_post_meta($page->ID, '_kb_page_slug', true));
|
||||
$sourceSlug = (string) get_post_meta($page->ID, '_kb_product_slug', true);
|
||||
$part = (array) ($parts[$sourceSlug] ?? []);
|
||||
?>
|
||||
<li>
|
||||
<a href="<?php echo esc_url($url_builder::page($product->slug, $version->slug, $slug)); ?>">
|
||||
<?php if (! empty($part['label']) && count($parts) > 1) : ?>
|
||||
<span class="kb-page-list__part"><?php echo esc_html((string) $part['label']); ?></span>
|
||||
<?php endif; ?>
|
||||
<?php echo esc_html(get_the_title($page)); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user