Skip to content
wiki.fftac.org

wiki.fftac.org Core - Source Excerpt 10

Back to wiki.fftac.org Core

Summary

This source excerpt preserves a bounded section of Wiki.FFTAC.org/wp-content/plugins/wiki-fftac-core/wiki-fftac-core.php so readers can inspect the evidence without opening the full source file.

**Source path:** Wiki.FFTAC.org/wp-content/plugins/wiki-fftac-core/wiki-fftac-core.php

$alias_page = aiwikis_core_get_content_page_by_route_alias( $slug );
		if ( ! empty( $alias_page ) && isset( $alias_page['route'] ) ) {
			wp_safe_redirect( home_url( (string) $alias_page['route'] ), 301 );
			exit;
		}

		aiwikis_core_render_missing_content_response( $slug );
	}
}
add_action( 'template_redirect', 'aiwikis_core_template_redirect', 0 );

/**
 * Register admin page.
 */
function aiwikis_core_admin_menu(): void {
	add_management_page(
		__( 'wiki.fftac.org', 'aiwikis-core' ),
		__( 'wiki.fftac.org', 'aiwikis-core' ),
		'manage_options',
		'aiwikis-core',
		'aiwikis_core_render_admin_page'
	);
}
add_action( 'admin_menu', 'aiwikis_core_admin_menu' );

/**
 * Render admin page.
 */
function aiwikis_core_render_admin_page(): void {
	if ( ! current_user_can( 'manage_options' ) ) {
		wp_die( esc_html__( 'You do not have permission to access this page.', 'aiwikis-core' ) );
	}

	$source_present  = '' !== aiwikis_core_get_source_manifest_path();
	$content_status = aiwikis_core_get_content_page_status();
	$routes         = array_merge(
		aiwikis_core_get_public_content_routes(),
		array(
			'/wp-json/wiki.fftac.org/v1/catalog',
			'/wp-json/wiki.fftac.org/v1/source-map',
			'/wp-json/wiki.fftac.org/v1/source-packages',
			'/wp-json/wiki-fftac/v1/source-packages',
			'/wp-json/wiki.fftac.org/v1/llms',
			'/wp-json/wiki-fftac/v1/llms',
			'/wp-json/wiki.fftac.org/v1/search-index',
			'/wp-json/wiki-fftac/v1/search-index',
			'/wp-json/wiki.fftac.org/v1/manifest',
			'/wp-json/wiki-fftac/v1/manifest',
			'/wp-json/wiki.fftac.org/v1/health',
			'/wp-json/wiki-fftac/v1/health',
			'/search/',
			'/llms.txt',
			'/.well-known/wiki.fftac.org.json',
			'/.well-known/wiki-fftac.json',
		)
	);
	?>
	<div class="wrap">
		<h1><?php esc_html_e( 'wiki.fftac.org', 'aiwikis-core' ); ?></h1>
		<p><?php esc_html_e( 'Status for wiki.fftac.org reviewed long-term memory and archive utilities.', 'aiwikis-core' ); ?></p>
		<table class="widefat striped">
			<tbody>
				<tr>
					<th><?php esc_html_e( 'Build version', 'aiwikis-core' ); ?></th>
					<td><?php echo esc_html( AIWIKIS_CORE_VERSION ); ?></td>
				</tr>
				<tr>
					<th><?php esc_html_e( 'Source manifest status', 'aiwikis-core' ); ?></th>
					<td><?php echo esc_html( $source_present ? __( 'Present', 'aiwikis-core' ) : __( 'Missing', 'aiwikis-core' ) ); ?></td>
				</tr>
				<tr>
					<th><?php esc_html_e( 'Source package policy', 'aiwikis-core' ); ?></th>
					<td><?php esc_html_e( 'wiki.fftac.org publishes reviewed memory and archive pointers; deployable WordPress zips are built by the workspace package script.', 'aiwikis-core' ); ?></td>
				</tr>
				<tr>
					<th><?php esc_html_e( 'File-backed content pages', 'aiwikis-core' ); ?></th>
					<td>
						<?php
						printf(
							/* translators: 1: available count, 2: content directory path. */
							esc_html__( '%1$d reviewed Markdown pages are served directly from %2$s.', 'aiwikis-core' ),
							(int) $content_status['available'],
							esc_html( (string) $content_status['dir'] )
						);
						?>
					</td>
				</tr>
				<tr>
					<th><?php esc_html_e( 'Release manifest status', 'aiwikis-core' ); ?></th>
					<td><?php esc_html_e( 'Generated by package script and reviewed outside public HTML.', 'aiwikis-core' ); ?></td>
				</tr>
			</tbody>
		</table>

		<h2><?php esc_html_e( 'Reviewed content source', 'aiwikis-core' ); ?></h2>
		<p><?php esc_html_e( 'Public pages are rendered from reviewed Markdown files at request time. Edit the Markdown source, rebuild the package when deploying, and avoid WordPress Page reseeding. Raw archive reports remain source-side memory and are not published automatically.', 'aiwikis-core' ); ?></p>

		<h2><?php esc_html_e( 'REST and discovery routes', 'aiwikis-core' ); ?></h2>
		<ul>
			<?php foreach ( $routes as $route ) : ?>
				<li><code><?php echo esc_html( $route ); ?></code></li>
			<?php endforeach; ?>
		</ul>

		<h2><?php esc_html_e( 'Warnings', 'aiwikis-core' ); ?></h2>
		<ul>
			<?php if ( ! $source_present ) : ?>
				<li><?php esc_html_e( 'Source manifest is missing. Run the fetch/package workflow or bundle a safe manifest copy.', 'aiwikis-core' ); ?></li>
			<?php endif; ?>
			<li><?php esc_html_e( 'Upload only the generated WordPress theme and plugin zips through wp-admin; keep the full workspace archive for source-side backup.', 'aiwikis-core' ); ?></li>
	</ul>
	</div>
	<?php
}

/**
 * Activation.
 */
function aiwikis_core_activate(): void {
	aiwikis_core_register_post_types();
	aiwikis_core_register_taxonomies();
	aiwikis_core_register_rewrite_rules();
	aiwikis_core_ensure_terms();
	flush_rewrite_rules();
}
register_activation_hook( __FILE__, 'aiwikis_core_activate' );

/**
 * Deactivation.
 */
function aiwikis_core_deactivate(): void {
	flush_rewrite_rules();
}
register_deactivation_hook( __FILE__, 'aiwikis_core_deactivate' );