Skip to content
wiki.fftac.org

Antichrist Resource - Source Excerpt 01

Back to Antichrist Resource

Summary

This source excerpt preserves a bounded section of FFTAC/wp-content/themes/fftac-who-we-are/antichrist-resource.php so readers can inspect the evidence without opening the full source file.

**Source path:** FFTAC/wp-content/themes/fftac-who-we-are/antichrist-resource.php

<?php
/**
 * Template for routed Antichrist resource pages.
 *
 * @package FFTAC_Who_We_Are
 */

$page = fftac_resource_page( fftac_resource_slug() );

if ( ! $page ) {
	get_template_part( '404' );
	return;
}

get_header();

/**
 * Check whether a URL points away from this site.
 *
 * @param string $url URL to check.
 * @return bool
 */
if ( ! function_exists( 'fftac_resource_is_external_url' ) ) {
	function fftac_resource_is_external_url( $url ) {
		$url_host  = wp_parse_url( $url, PHP_URL_HOST );
		$home_host = wp_parse_url( home_url( '/' ), PHP_URL_HOST );

		return is_string( $url_host ) && is_string( $home_host ) && strtolower( $url_host ) !== strtolower( $home_host );
	}
}

/**
 * Render paragraphs safely.
 *
 * @param array<int,string> $paragraphs Paragraph text.
 */
if ( ! function_exists( 'fftac_resource_render_paragraphs' ) ) {
	function fftac_resource_render_paragraphs( $paragraphs ) {
		foreach ( $paragraphs as $paragraph ) {
			printf( '<p>%s</p>', esc_html( $paragraph ) );
		}
	}
}

/**
 * Render a linked or unlinked content item.
 *
 * @param array<string,mixed> $item Item data.
 */
if ( ! function_exists( 'fftac_resource_render_item' ) ) {
	function fftac_resource_render_item( $item ) {
		$has_url = ! empty( $item['url'] );

		echo '<article class="path-card resource-card">';

		if ( $has_url ) {
			$is_external = fftac_resource_is_external_url( $item['url'] );
			printf(
				'<h3><a href="%1$s"%2$s>%3$s</a></h3>',
				esc_url( $item['url'] ),
				$is_external ? ' target="_blank" rel="noopener noreferrer"' : '',
				esc_html( $item['title'] )
			);
		} else {
			printf( '<h3>%s</h3>', esc_html( $item['title'] ) );
		}

		if ( ! empty( $item['body'] ) ) {
			printf( '<p>%s</p>', esc_html( $item['body'] ) );
		}

		if ( $has_url ) {
			printf(
				'<p class="resource-card-action"><a href="%1$s"%2$s>%3$s</a></p>',
				esc_url( $item['url'] ),
				fftac_resource_is_external_url( $item['url'] ) ? ' target="_blank" rel="noopener noreferrer"' : '',
				esc_html__( 'Open resource', 'fftac-who-we-are' )
			);
		}

		echo '</article>';
	}
}

/**
 * Render source or archive-only link rows.
 *
 * @param array<string,mixed> $item Link item.
 */
if ( ! function_exists( 'fftac_resource_render_source_item' ) ) {
	function fftac_resource_render_source_item( $item ) {
		if ( ! empty( $item['archive_only'] ) ) {
			echo '<div class="source-link is-archive-only">';
			printf( '<span>%s</span>', esc_html( $item['label'] ) );
			if ( ! empty( $item['note'] ) ) {
				printf( '<small>%s</small>', esc_html( $item['note'] ) );
			}
			echo '</div>';
			return;
		}

		$is_external = ! empty( $item['url'] ) && fftac_resource_is_external_url( $item['url'] );

		printf(
			'<a class="source-link" href="%1$s"%2$s><span>%3$s</span>%4$s</a>',
			esc_url( $item['url'] ),
			$is_external ? ' target="_blank" rel="noopener noreferrer"' : '',
			esc_html( $item['label'] ),
			! empty( $item['note'] ) ? '<small>' . esc_html( $item['note'] ) . '</small>' : ''
		);
	}
}

$page_index = fftac_resource_index();
?>

<main id="primary" class="main resource-main">
	<nav class="resource-breadcrumbs" aria-label="<?php esc_attr_e( 'Breadcrumb', 'fftac-who-we-are' ); ?>">
		<ol>
			<li><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php esc_html_e( 'Home', 'fftac-who-we-are' ); ?></a></li>
			<?php if ( 'hub' === $page['slug'] ) : ?>
				<li aria-current="page"><?php echo esc_html( $page['title'] ); ?></li>
			<?php else : ?>
				<li><a href="<?php echo esc_url( fftac_resource_url( 'hub' ) ); ?>"><?php esc_html_e( 'Antichrist Hub', 'fftac-who-we-are' ); ?></a></li>
				<li aria-current="page"><?php echo esc_html( $page['title'] ); ?></li>
			<?php endif; ?>
		</ol>
	</nav>

	<header class="resource-hero section">
		<div class="resource-hero-copy">
			<p class="section-kicker"><?php echo esc_html( $page['kicker'] ); ?></p>
			<h1><?php echo esc_html( $page['title'] ); ?></h1>
			<?php if ( ! empty( $page['description'] ) ) : ?>
				<p class="resource-description"><?php echo esc_html( $page['description'] ); ?></p>
			<?php endif; ?>
			<?php fftac_resource_render_paragraphs( isset( $page['intro'] ) ? $page['intro'] : array() ); ?>
			<div class="hero-actions">
				<a class="button" href="<?php echo esc_url( fftac_resource_url( 'hub' ) ); ?>"><?php esc_html_e( 'Resource Hub', 'fftac-who-we-are' ); ?></a>
				<a class="button secondary" href="<?php echo esc_url( fftac_resource_sitemap_url() ); ?>"><?php esc_html_e( 'XML Sitemap', 'fftac-who-we-are' ); ?></a>
			</div>
		</div>
		<aside class="resource-index-panel" aria-label="<?php esc_attr_e( 'Antichrist resource pages', 'fftac-who-we-are' ); ?>">
			<p class="section-kicker"><?php esc_html_e( 'Resource Pages', 'fftac-who-we-are' ); ?></p>
			<ul>
				<?php foreach ( $page_index as $index_item ) : ?>
					<li>
						<a class="<?php echo esc_attr( $index_item['slug'] === $page['slug'] ? 'is-current' : '' ); ?>" href="<?php echo esc_url( $index_item['url'] ); ?>">
							<?php echo esc_html( $index_item['short_title'] ); ?>
						</a>
					</li>
				<?php endforeach; ?>
			</ul>
		</aside>
	</header>

	<div class="resource-layout">
		<aside class="resource-toc" aria-label="<?php esc_attr_e( 'Page contents', 'fftac-who-we-are' ); ?>">
			<p class="section-kicker"><?php esc_html_e( 'On This Page', 'fftac-who-we-are' ); ?></p>
			<ol>
				<?php foreach ( $page['sections'] as $section_index => $section ) : ?>
					<li><a href="#<?php echo esc_attr( $page['slug'] . '-' . $section_index . '-' . sanitize_title( $section['title'] ) ); ?>"><?php echo esc_html( $section['title'] ); ?></a></li>
				<?php endforeach; ?>
				<?php if ( ! empty( $page['links'] ) ) : ?>
					<li><a href="#resource-links"><?php esc_html_e( 'Resource Links', 'fftac-who-we-are' ); ?></a></li>
				<?php endif; ?>
				<?php if ( ! empty( $page['related'] ) ) : ?>
					<li><a href="#related-pages"><?php esc_html_e( 'Related Pages', 'fftac-who-we-are' ); ?></a></li>
				<?php endif; ?>
			</ol>
		</aside>

		<article class="resource-article">
			<?php foreach ( $page['sections'] as $section_index => $section ) : ?>
				<section id="<?php echo esc_attr( $page['slug'] . '-' . $section_index . '-' . sanitize_title( $section['title'] ) ); ?>" class="resource-section">
					<h2><?php echo esc_html( $section['title'] ); ?></h2>
					<?php if ( ! empty( $section['body'] ) ) : ?>
						<div class="resource-section-body">
							<?php fftac_resource_render_paragraphs( $section['body'] ); ?>
						</div>
					<?php endif; ?>

					<?php if ( ! empty( $section['bullets'] ) ) : ?>
						<ul class="resource-list">
							<?php foreach ( $section['bullets'] as $bullet ) : ?>
								<li><?php echo esc_html( $bullet ); ?></li>
							<?php endforeach; ?>
						</ul>
					<?php endif; ?>

					<?php if ( ! empty( $section['items'] ) ) : ?>
						<div class="card-grid two resource-card-grid">
							<?php foreach ( $section['items'] as $item ) : ?>
								<?php fftac_resource_render_item( $item ); ?>
							<?php endforeach; ?>
						</div>
					<?php endif; ?>
				</section>
			<?php endforeach; ?>

			<?php if ( ! empty( $page['links'] ) ) : ?>
				<section id="resource-links" class="resource-section source-section">
					<h2><?php esc_html_e( 'Resource Links', 'fftac-who-we-are' ); ?></h2>
					<p><?php esc_html_e( 'Links are curated for research value and safety. External links open in a new tab; archive-only items are intentionally not linked from the public directory.', 'fftac-who-we-are' ); ?></p>
					<div class="source-groups">
						<?php foreach ( $page['links'] as $group ) : ?>
							<section class="source-group">
								<h3><?php echo esc_html( $group['title'] ); ?></h3>
								<?php if ( ! empty( $group['note'] ) ) : ?>
									<p><?php echo esc_html( $group['note'] ); ?></p>
								<?php endif; ?>
								<div class="source-list">
									<?php foreach ( $group['items'] as $link_item ) : ?>
										<?php fftac_resource_render_source_item( $link_item ); ?>
									<?php endforeach; ?>
								</div>
							</section>
						<?php endforeach; ?>
					</div>
				</section>
			<?php endif; ?>

			<?php if ( ! empty( $page['related'] ) ) : ?>
				<section id="related-pages" class="resource-section related-section">
					<h2><?php esc_html_e( 'Related Pages', 'fftac-who-we-are' ); ?></h2>
					<div class="card-grid dense resource-card-grid">
						<?php foreach ( $page['related'] as $related_slug ) : ?>
							<?php $related_page = fftac_resource_page( $related_slug ); ?>
							<?php if ( $related_page ) : ?>
								<?php
								fftac_resource_render_item(
									array(
										'title' => $related_page['title'],
										'body'  => isset( $related_page['description'] ) ? $related_page['description'] : '',
										'url'   => fftac_resource_url( $related_page['slug'] ),
									)
								);
								?>
							<?php endif; ?>
						<?php endforeach; ?>
					</div>
				</section>
			<?php endif; ?>
		</article>
	</div>
</main>