Restore to commit 74e578279624c6045ca440a3459ebfa1f8d54191

This commit is contained in:
southseact-3d
2026-02-07 20:32:41 +00:00
commit ed67b7741b
252 changed files with 99814 additions and 0 deletions

View File

@@ -0,0 +1,133 @@
<?php
/**
* Changelog Archive Template
*
* @package PCChangelogManager
*/
// Prevent direct access to file.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Let theme handle header/footer
get_header();
?>
<div class="site-content" role="main">
<div class="pc-clm-archive-container">
<header class="pc-clm-archive-header">
<h1 class="pc-clm-archive-title">
<?php
$archive_title = post_type_archive_title( '', false );
if ( $archive_title ) {
echo esc_html( $archive_title );
} else {
esc_html_e( 'Changelog', 'pc-changelog-manager-abc123' );
}
?>
</h1>
<?php if ( $description = get_the_archive_description() ) : ?>
<div class="pc-clm-archive-description"><?php echo $description; ?></div>
<?php endif; ?>
</header>
<div class="pc-clm-archive-content">
<?php
$post_type = new PC_CLM_Post_Type();
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
$post_id = get_the_ID();
$version = $post_type->get_meta( $post_id, 'version_number' );
$release_date = $post_type->get_meta( $post_id, 'release_date' );
$category = $post_type->get_meta( $post_id, 'category' );
$categories = $post_type->get_categories();
$category_name = isset( $categories[ $category ] ) ? $categories[ $category ] : $category;
$upvote_count = (int) get_post_meta( $post_id, '_pc_clm_upvotes', true );
$has_voted = false;
$ip_address = $_SERVER['REMOTE_ADDR'];
$user_id = get_current_user_id();
$voted_key = $user_id ? "pc_clm_voted_user_{$user_id}" : "pc_clm_voted_ip_{$ip_address}";
$voted_posts = get_transient( $voted_key );
if ( $voted_posts && in_array( $post_id, $voted_posts ) ) {
$has_voted = true;
}
$entry_classes = array( 'pc-clm-entry' );
if ( $category ) {
$entry_classes[] = 'pc-clm-category-' . $category;
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class( $entry_classes ); ?>>
<div class="pc-clm-entry-wrapper">
<div class="pc-clm-entry-header">
<div class="pc-clm-entry-meta">
<?php if ( $version ) : ?>
<span class="pc-clm-version-badge"><?php echo esc_html( $version ); ?></span>
<?php endif; ?>
<?php if ( $release_date ) : ?>
<span class="pc-clm-release-date"><?php echo esc_html( date_i18n( get_option( 'date_format' ), strtotime( $release_date ) ) ); ?></span>
<?php endif; ?>
<?php if ( $category ) : ?>
<span class="pc-clm-category-badge pc-clm-category-<?php echo esc_attr( $category ); ?>"><?php echo esc_html( $category_name ); ?></span>
<?php endif; ?>
</div>
<div class="pc-clm-upvote-section">
<button class="pc-clm-upvote-btn <?php echo $has_voted ? 'voted' : ''; ?>"
data-post-id="<?php echo esc_attr( $post_id ); ?>"
<?php echo $has_voted ? 'disabled' : ''; ?>>
<span class="pc-clm-upvote-icon">
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2l2.4 7.4h7.6l-6 4.6 2.3 7.4-6.3-4.6-6.3 4.6 2.3-7.4-6-4.6h7.6z"/>
</svg>
</span>
<span class="pc-clm-upvote-count"><?php echo esc_html( $upvote_count ); ?></span>
</button>
<span class="pc-clm-upvote-label"><?php echo esc_html( _n( 'upvote', 'upvotes', $upvote_count, 'pc-changelog-manager-abc123' ) ); ?></span>
</div>
</div>
<div class="pc-clm-entry-content-wrapper">
<h3 class="pc-clm-entry-title">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h3>
<div class="pc-clm-entry-content">
<?php the_excerpt(); ?>
</div>
</div>
</div>
</article>
<?php
endwhile;
the_posts_pagination(
array(
'prev_text' => __( 'Previous', 'pc-changelog-manager-abc123' ),
'next_text' => __( 'Next', 'pc-changelog-manager-abc123' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'pc-changelog-manager-abc123' ) . ' </span>',
)
);
else :
?>
<div class="pc-clm-no-entries">
<p><?php esc_html_e( 'No changelog entries found.', 'pc-changelog-manager-abc123' ); ?></p>
</div>
<?php
endif;
?>
</div>
</div>
</div>
<?php get_footer(); ?>