Plugin packaging and docs

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-09 22:45:30 +00:00
parent 80f1709a2e
commit 4343f62140
63 changed files with 1369 additions and 223 deletions

View File

@@ -0,0 +1,117 @@
<?php
/**
* IGNY8 Content Sections
* Parses content HTML and displays sections with in-article images
*
* @package Igny8Bridge
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
?>
<div class="igny8-content-body">
<!-- Introduction (content before first H2) -->
<?php if (!empty($parsed_content['intro'])): ?>
<section class="igny8-intro-section">
<div class="igny8-section-label">Opening Narrative</div>
<div class="igny8-prose">
<?php echo $parsed_content['intro']; ?>
</div>
</section>
<?php endif; ?>
<!-- H2 Sections with Images -->
<?php if (!empty($parsed_content['sections'])): ?>
<?php foreach ($parsed_content['sections'] as $index => $section): ?>
<section class="igny8-content-section" id="<?php echo esc_attr($section['id']); ?>">
<div class="igny8-section-container">
<div class="igny8-section-header">
<span class="igny8-section-number"><?php echo $index + 1; ?></span>
<div class="igny8-section-heading-wrapper">
<span class="igny8-section-label">Section Spotlight</span>
<h2 class="igny8-section-heading"><?php echo esc_html($section['heading']); ?></h2>
</div>
</div>
<?php
// Get image for this section (position = section index + 1)
$section_position = $index + 1;
// Try multiple sources for in-article images
$img_data = null;
$img_url = null;
$img_prompt = '';
// Source 1: From $in_article_images array
if (isset($in_article_images[$section_position])) {
$img_data = $in_article_images[$section_position];
if (isset($img_data['attachment_id'])) {
$img_url = wp_get_attachment_image_url($img_data['attachment_id'], 'large');
$img_prompt = isset($img_data['prompt']) ? $img_data['prompt'] : '';
} elseif (isset($img_data['url'])) {
$img_url = $img_data['url'];
$img_prompt = isset($img_data['prompt']) ? $img_data['prompt'] : '';
}
}
// Source 2: Check gallery images meta
if (!$img_url) {
$gallery = get_post_meta(get_the_ID(), '_igny8_gallery_images', true);
if ($gallery && is_array($gallery) && isset($gallery[$index])) {
$img_url = wp_get_attachment_image_url($gallery[$index], 'large');
}
}
$has_image = !empty($img_url);
?>
<div class="igny8-section-content<?php echo $has_image ? ' igny8-has-image' : ''; ?>">
<div class="igny8-section-text">
<div class="igny8-prose">
<?php echo $section['content']; ?>
</div>
</div>
<?php if ($has_image):
$img_alt = '';
if (isset($img_data['attachment_id'])) {
$img_alt = get_post_meta($img_data['attachment_id'], '_wp_attachment_image_alt', true);
}
?>
<div class="igny8-section-image">
<figure class="igny8-image-figure">
<img src="<?php echo esc_url($img_url); ?>"
alt="<?php echo esc_attr($img_alt ?: $section['heading']); ?>"
class="igny8-in-article-image"
loading="lazy">
<?php if ($img_prompt): ?>
<figcaption class="igny8-image-caption">
<p class="igny8-caption-label">Visual Direction</p>
<p class="igny8-caption-text"><?php echo esc_html($img_prompt); ?></p>
</figcaption>
<?php endif; ?>
</figure>
</div>
<?php endif; ?>
</div>
</div>
</section>
<?php endforeach; ?>
<?php endif; ?>
<!-- Fallback: If no sections parsed, show content as-is -->
<?php if (empty($parsed_content['intro']) && empty($parsed_content['sections'])): ?>
<section class="igny8-content-fallback">
<div class="igny8-prose">
<?php echo $content; ?>
</div>
</section>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,40 @@
<?php
/**
* IGNY8 Featured Image Block
* Displays featured image with AI prompt if available
*
* @package Igny8Bridge
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
$image_url = wp_get_attachment_image_url($featured_image_id, 'full');
$image_alt = get_post_meta($featured_image_id, '_wp_attachment_image_alt', true);
if (!$image_url) {
return;
}
?>
<div class="igny8-featured-image-block">
<div class="igny8-featured-header">
<span class="igny8-featured-label">Featured Visual</span>
</div>
<div class="igny8-featured-image-wrapper">
<img src="<?php echo esc_url($image_url); ?>"
alt="<?php echo esc_attr($image_alt ?: get_the_title()); ?>"
class="igny8-featured-image"
loading="lazy">
</div>
<?php if ($featured_image_prompt): ?>
<div class="igny8-image-prompt">
<p class="igny8-prompt-label">AI Image Prompt</p>
<p class="igny8-prompt-text"><?php echo esc_html($featured_image_prompt); ?></p>
</div>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,151 @@
<?php
/**
* IGNY8 Content Header
* Displays title, status, and metadata
*
* @package Igny8Bridge
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
$status_label = igny8_format_status_label($status);
$status_class = igny8_get_status_class($status);
?>
<div class="igny8-header">
<!-- Back Button -->
<div class="igny8-header-back">
<a href="<?php echo esc_url(get_post_type_archive_link('post')); ?>" class="igny8-back-button">
<span class="igny8-back-icon">←</span>
<span>Back to Posts</span>
</a>
</div>
<!-- Title & Status -->
<div class="igny8-header-title-row">
<h1 class="igny8-title"><?php the_title(); ?></h1>
<span class="igny8-status-badge <?php echo esc_attr($status_class); ?>">
<?php echo esc_html($status_label); ?>
</span>
</div>
<!-- Metadata Row -->
<div class="igny8-metadata-row">
<!-- Created Date -->
<div class="igny8-meta-item">
<span class="igny8-meta-icon">📅</span>
<span class="igny8-meta-label">Posted:</span>
<span class="igny8-meta-value"><?php echo get_the_date(); ?></span>
</div>
<!-- Word Count -->
<?php if ($word_count > 0): ?>
<div class="igny8-meta-item">
<span class="igny8-meta-icon">📝</span>
<span class="igny8-meta-label">Words:</span>
<span class="igny8-meta-value"><?php echo number_format($word_count); ?></span>
</div>
<?php endif; ?>
<!-- Author -->
<div class="igny8-meta-item">
<span class="igny8-meta-icon">✍️</span>
<span class="igny8-meta-label">Author:</span>
<span class="igny8-meta-value"><?php the_author(); ?></span>
</div>
<!-- Categories -->
<?php if ($categories && !is_wp_error($categories)): ?>
<div class="igny8-meta-item">
<span class="igny8-meta-icon">📁</span>
<span class="igny8-meta-label">Categories:</span>
<div class="igny8-meta-badges">
<?php foreach ($categories as $cat): ?>
<span class="igny8-category-badge"><?php echo esc_html($cat->name); ?></span>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<!-- Tags -->
<?php if ($tags && !is_wp_error($tags)): ?>
<div class="igny8-meta-item">
<span class="igny8-meta-icon">🏷️</span>
<span class="igny8-meta-label">Tags:</span>
<div class="igny8-meta-badges">
<?php foreach ($tags as $tag): ?>
<span class="igny8-tag-badge"><?php echo esc_html($tag->name); ?></span>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
<!-- SEO Metadata Section -->
<?php if (($meta_title && $meta_title !== get_the_title()) || $meta_description): ?>
<div class="igny8-seo-section">
<div class="igny8-seo-header">SEO Metadata</div>
<?php if ($meta_title && $meta_title !== get_the_title()): ?>
<div class="igny8-seo-item">
<label class="igny8-seo-label">SEO Title:</label>
<div class="igny8-seo-value"><?php echo esc_html($meta_title); ?></div>
</div>
<?php endif; ?>
<?php if ($meta_description): ?>
<div class="igny8-seo-item">
<label class="igny8-seo-label">Meta Description:</label>
<div class="igny8-seo-value"><?php echo esc_html($meta_description); ?></div>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<!-- IGNY8 Content Info -->
<?php if ($cluster_name || $primary_keyword || $content_type): ?>
<div class="igny8-info-section">
<div class="igny8-info-header">Content Information</div>
<div class="igny8-info-grid">
<?php if ($content_type): ?>
<div class="igny8-info-item">
<label>Type:</label>
<span><?php echo esc_html(ucfirst($content_type)); ?></span>
</div>
<?php endif; ?>
<?php if ($structure): ?>
<div class="igny8-info-item">
<label>Structure:</label>
<span><?php echo esc_html(ucfirst($structure)); ?></span>
</div>
<?php endif; ?>
<?php if ($cluster_name): ?>
<div class="igny8-info-item">
<label>Cluster:</label>
<span><?php echo esc_html($cluster_name); ?></span>
</div>
<?php endif; ?>
<?php if ($primary_keyword): ?>
<div class="igny8-info-item">
<label>Primary Keyword:</label>
<span><?php echo esc_html($primary_keyword); ?></span>
</div>
<?php endif; ?>
<?php if ($source): ?>
<div class="igny8-info-item">
<label>Source:</label>
<span><?php echo esc_html(ucfirst($source)); ?></span>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,90 @@
<?php
/**
* IGNY8 Metadata Footer
* Shows IGNY8-specific metadata in collapsible format
*
* @package Igny8Bridge
*/
// Exit if accessed directly
if (!defined('ABSPATH')) {
exit;
}
// Only show if we have IGNY8 content ID
if (!$content_id) {
return;
}
?>
<div class="igny8-metadata-footer">
<details class="igny8-metadata-details">
<summary class="igny8-metadata-summary">
View IGNY8 Metadata
</summary>
<div class="igny8-metadata-content">
<table class="igny8-metadata-table">
<tbody>
<tr>
<th>Content ID:</th>
<td><?php echo esc_html($content_id); ?></td>
</tr>
<?php if ($task_id): ?>
<tr>
<th>Task ID:</th>
<td><?php echo esc_html($task_id); ?></td>
</tr>
<?php endif; ?>
<?php if ($content_type): ?>
<tr>
<th>Content Type:</th>
<td><?php echo esc_html(ucfirst($content_type)); ?></td>
</tr>
<?php endif; ?>
<?php if ($structure): ?>
<tr>
<th>Structure:</th>
<td><?php echo esc_html(ucfirst($structure)); ?></td>
</tr>
<?php endif; ?>
<?php if ($source): ?>
<tr>
<th>Source:</th>
<td><?php echo esc_html(ucfirst($source)); ?></td>
</tr>
<?php endif; ?>
<?php if ($cluster_id): ?>
<tr>
<th>Cluster ID:</th>
<td><?php echo esc_html($cluster_id); ?></td>
</tr>
<?php endif; ?>
<?php if ($sector_id): ?>
<tr>
<th>Sector ID:</th>
<td><?php echo esc_html($sector_id); ?></td>
</tr>
<?php endif; ?>
<?php if ($keywords_array): ?>
<tr>
<th>Secondary Keywords:</th>
<td>
<div class="igny8-keywords-list">
<?php foreach ($keywords_array as $kw): ?>
<span class="igny8-keyword-tag"><?php echo esc_html($kw); ?></span>
<?php endforeach; ?>
</div>
</td>
</tr>
<?php endif; ?>
<?php if ($last_synced): ?>
<tr>
<th>Last Synced:</th>
<td><?php echo esc_html(date('F j, Y, g:i a', strtotime($last_synced))); ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</details>
</div>