initial COmmit: Add KB Antora Importer plugin files

This commit is contained in:
Sven Steinert
2026-05-12 14:37:09 +02:00
parent cf253c1367
commit 6abf6f9c3d
39 changed files with 2945 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
namespace KbAntoraImporter\Repository;
final class VersionRepository
{
public function ensure(string $version): int
{
$term = term_exists($version, 'kb_version');
if (! $term) {
$term = wp_insert_term($version, 'kb_version', ['slug' => sanitize_title($version)]);
}
return is_wp_error($term) ? 0 : (int) ($term['term_id'] ?? $term);
}
}