Skip to content
wiki.fftac.org

Antichrist Content System Implementation - Source Excerpt 22

Back to Antichrist Content System Implementation

Summary

This source excerpt preserves a bounded section of Antichrist.net/wp-content/plugins/antichrist-content-system/includes/antichrist-content-system-implementation.php so readers can inspect the evidence without opening the full source file.

**Source path:** Antichrist.net/wp-content/plugins/antichrist-content-system/includes/antichrist-content-system-implementation.php

update_post_meta( $page_id, '_acn_content_system_page', ACN_CONTENT_SYSTEM_VERSION );
	if ( ! empty( $page['template'] ) ) {
		update_post_meta( $page_id, '_wp_page_template', $page['template'] );
	}

	return (int) $page_id;
}

/**
 * Build primary and footer menus.
 */
function acn_cs_rebuild_menus() {
	$primary_items = array(
		''                   => 'Home',
		'archive'            => 'Archive',
		'research-agenda'    => 'Research Agenda',
		'research-library'   => 'Library',
		'timeline'           => 'Timeline',
		'symbols'            => 'Symbols',
		'apocalyptic-ai'     => 'Apocalyptic AI',
		'state-and-religion' => 'State & Religion',
		'surveillance'       => 'Surveillance',
		'community-baseline' => 'Community Baseline',
		'about'              => 'About',
	);

	$footer_items = array(
		'archive'                             => 'Archive',
		'topics'                              => 'Topics Directory',
		'timeline'                            => 'Timeline',
		'symbols'                             => 'Symbols',
		'state-and-religion'                  => 'State & Religion',
		'surveillance'                        => 'Surveillance',
		'pre-christian-antichrist-history'    => 'Pre-Christian Antichrist History',
		'antichrist-like-figures-eastern-philosophy' => 'Antichrist-Like Figures in Eastern Philosophy',
		'katechon'                            => 'Katechon',
		'apocalyptic-ai'                      => 'Apocalyptic AI',
		'eschatological-accelerationism'      => 'Eschatological Accelerationism',
		'prophecy-tracking-resource-curation' => 'Prophecy Tracking and Resource Curation',
		'apocalyptic-optimism'                => 'Apocalyptic Optimism',
		'doomsday-preparedness'               => 'Doomsday Preparedness',
		'antichrist-as-redeemer-of-mankind'   => 'Antichrist as Redeemer of Mankind',
		'antichrist-redeemer-second-coming'   => 'Antichrist as Redeemer and Second Coming',
		'current-antichrist-cults'            => 'Current Antichrist Cults',
		'antichrist-militia-groups'           => 'Antichrist Militia Groups',
		'message-board'                       => 'Message Board',
		'members'                             => 'Members',
		'community-baseline'                  => 'Community Baseline',
		'about'                               => 'About',
		'editorial-policy'                    => 'Editorial Policy',
		'archive-and-content-strategy'        => 'Archive and Content Strategy',
		'research-agenda'                    => 'Research Agenda',
		'research-library'                    => 'Research Library',
	);

	$primary_id = acn_cs_rebuild_menu( 'Antichrist.net Primary Sections', $primary_items );
	$footer_id  = acn_cs_rebuild_menu( 'Antichrist.net Footer Sections', $footer_items );

	$locations = (array) get_theme_mod( 'nav_menu_locations', array() );
	if ( $primary_id ) {
		$locations['primary'] = $primary_id;
	}
	if ( $footer_id ) {
		$locations['footer'] = $footer_id;
	}
	set_theme_mod( 'nav_menu_locations', $locations );
}

/**
 * Rebuild a named menu from page paths.
 *
 * @param string $name Menu name.
 * @param array  $items Path => label.
 * @return int
 */
function acn_cs_rebuild_menu( $name, $items ) {
	$menus = get_terms(
		array(
			'taxonomy'   => 'nav_menu',
			'hide_empty' => false,
			'name'       => $name,
			'orderby'    => 'term_id',
			'order'      => 'ASC',
		)
	);

	if ( is_wp_error( $menus ) || empty( $menus ) ) {
		$menu_id = wp_create_nav_menu( $name );
	} else {
		$menu_id = (int) $menus[0]->term_id;
		for ( $i = 1; $i < count( $menus ); $i++ ) {
			$duplicate_items = wp_get_nav_menu_items( (int) $menus[ $i ]->term_id );
			if ( $duplicate_items ) {
				foreach ( $duplicate_items as $item ) {
					wp_delete_post( $item->ID, true );
				}
			}
			wp_delete_term( (int) $menus[ $i ]->term_id, 'nav_menu' );
		}

		$existing_items = wp_get_nav_menu_items( $menu_id );
		if ( $existing_items ) {
			foreach ( $existing_items as $item ) {
				wp_delete_post( $item->ID, true );
			}
		}
	}

	if ( is_wp_error( $menu_id ) || ! $menu_id ) {
		return 0;
	}

	foreach ( $items as $path => $label ) {
		if ( '' === (string) $path || '/' === (string) $path ) {
			wp_update_nav_menu_item(
				$menu_id,
				0,
				array(
					'menu-item-title'  => $label,
					'menu-item-url'    => home_url( '/' ),
					'menu-item-type'   => 'custom',
					'menu-item-status' => 'publish',
				)
			);
			continue;
		}

		$page = get_page_by_path( $path );
		if ( ! $page instanceof WP_Post ) {
			continue;
		}
		wp_update_nav_menu_item(
			$menu_id,
			0,
			array(
				'menu-item-title'     => $label,
				'menu-item-object'    => 'page',
				'menu-item-object-id' => $page->ID,
				'menu-item-type'      => 'post_type',
				'menu-item-status'    => 'publish',
			)
		);
	}

	return (int) $menu_id;
}

/**
 * Build a section page.
 *
 * @param string $intro Intro text.
 * @param array  $cards Linked cards.
 * @param array  $sources Source filenames.
 * @return string
 */
function acn_cs_section_content( $intro, $cards, $sources ) {
	$html  = '<div class="editorial-callout"><p>' . esc_html( $intro ) . '</p></div>';
	$html .= '<section class="section-directory"><h2>Pages in this section</h2>';
	$html .= acn_cs_card_grid( $cards );
	$html .= '<h2>Complete page index</h2>[acn_child_pages]';
	$html .= '</section>';
	return $html;
}

/**
 * Build a richer report-derived topic page.
 *
 * @param string $title Page title.
 * @param string $intro Intro text.
 * @param array  $points Heading => text pairs.
 * @param array  $sources Source filenames.
 * @return array
 */
function acn_cs_rich_page( $title, $intro, $points, $sources ) {
	return array(
		'title'   => $title,
		'content' => acn_cs_rich_topic_content( $intro, $points, $sources ),
		'template' => 'templates/template-full-width.php',
	);
}