Skip to content
wiki.fftac.org

Virtual Pages - Source Excerpt 56

Back to Virtual Pages

Summary

This source excerpt preserves a bounded section of 2IA.org/wp-content/themes/twoia-intelligence/inc/virtual-pages.php so readers can inspect the evidence without opening the full source file.

**Source path:** 2IA.org/wp-content/themes/twoia-intelligence/inc/virtual-pages.php

/**
 * Render the public question panel for a virtual route.
 *
 * @param array $page    Virtual page definition.
 * @param array $section Optional section-backed child route.
 * @param array $dossier Optional dossier payload.
 */
function twoia_render_virtual_share_panel( $page, $section = null, $dossier = array() ) {
	$payload = twoia_get_virtual_share_payload( $page, $section, $dossier );
	$panel_id = 'twoia-share-panel-' . sanitize_html_class( str_replace( '/', '-', trim( $page['slug'] ?? 'route', '/' ) ) );
	$text_id  = $panel_id . '-text';
	?>
	<section class="twoia-share-panel" aria-labelledby="<?php echo esc_attr( $panel_id ); ?>">
		<div class="twoia-share-panel__argument">
			<p class="eyebrow"><?php echo esc_html( $payload['label'] ); ?></p>
			<h2 id="<?php echo esc_attr( $panel_id ); ?>"><?php echo esc_html( $payload['question'] ); ?></h2>
			<p id="<?php echo esc_attr( $text_id ); ?>" class="twoia-share-panel__line"><?php echo esc_html( $payload['line'] ); ?></p>
			<p><?php echo esc_html( $payload['stakes'] ); ?></p>
		</div>
		<div class="twoia-share-panel__lists">
			<section>
				<h3><?php esc_html_e( 'Use this when', 'two-identities-anonymous' ); ?></h3>
				<?php twoia_render_virtual_dossier_list( $payload['send_when'] ); ?>
			</section>
			<section>
				<h3><?php esc_html_e( 'Records that answer it', 'two-identities-anonymous' ); ?></h3>
				<?php twoia_render_virtual_dossier_list( $payload['records'] ); ?>
			</section>
		</div>
		<div class="twoia-share-panel__demand">
			<strong><?php esc_html_e( 'Ask for this', 'two-identities-anonymous' ); ?></strong>
			<p><?php echo esc_html( $payload['demand'] ); ?></p>
			<button class="button button--secondary" type="button" data-copy-text="<?php echo esc_attr( $payload['copy'] ); ?>" data-copy-success="<?php esc_attr_e( 'Question copied', 'two-identities-anonymous' ); ?>"><?php esc_html_e( 'Copy this question', 'two-identities-anonymous' ); ?></button>
		</div>
	</section>
	<?php
}

/**
 * Normalize a string-or-array field into renderable text items.
 *
 * @param mixed $value Text field.
 * @return array
 */
function twoia_virtual_text_items( $value ) {
	if ( empty( $value ) ) {
		return array();
	}

	if ( is_array( $value ) ) {
		return array_values(
			array_filter(
				$value,
				static function ( $item ) {
					return ! empty( $item );
				}
			)
		);
	}

	return array( $value );
}

/**
 * Render dossier paragraphs.
 *
 * @param mixed $items Paragraph text.
 */
function twoia_render_virtual_dossier_paragraphs( $items ) {
	foreach ( twoia_virtual_text_items( $items ) as $item ) :
		?>
		<p><?php echo esc_html( $item ); ?></p>
		<?php
	endforeach;
}

/**
 * Render dossier list items.
 *
 * @param mixed $items List item text.
 */
function twoia_render_virtual_dossier_list( $items ) {
	$items = twoia_virtual_text_items( $items );

	if ( empty( $items ) ) {
		return;
	}
	?>
	<ul>
		<?php foreach ( $items as $item ) : ?>
			<li><?php echo esc_html( $item ); ?></li>
		<?php endforeach; ?>
	</ul>
	<?php
}


/**
 * Normalize a direct resource row.
 *
 * @param string $title Link title.
 * @param string $url   Direct URL.
 * @param string $note  Context note.
 * @return array
 */
function twoia_direct_resource( $title, $url, $note ) {
	return array(
		'title' => $title,
		'url'   => $url,
		'note'  => $note,
	);
}

/**
 * Return the direct resource bank used by detail pages.
 *
 * The first spine comes from the active "Directory of OSINT and Hacktivist
 * Organizations" handoff. The rest are stable primary, institutional, or
 * high-value reference pages. Do not add third-party search-result URLs here.
 *
 * @return array
 */
function twoia_direct_resource_bank() {
	static $resources = null;

	if ( null !== $resources ) {
		return $resources;
	}

	$directory_note = __( 'Official organization page from the 2IA directory seed; use it to verify identity, scope, and current work.', 'two-identities-anonymous' );
	$reference_note = __( 'Direct reference page for checking records, rights, governance, privacy, AI risk, or public accountability context.', 'two-identities-anonymous' );

	$resources = array(
		twoia_direct_resource( 'Bellingcat', 'https://www.bellingcat.com/', $directory_note ),
		twoia_direct_resource( 'Global Investigative Journalism Network', 'https://gijn.org/', $directory_note ),
		twoia_direct_resource( 'Centre for Information Resilience', 'https://www.info-res.org/', $directory_note ),
		twoia_direct_resource( 'C4ADS', 'https://c4ads.org/', $directory_note ),
		twoia_direct_resource( 'Mnemonic', 'https://mnemonic.org/', $directory_note ),
		twoia_direct_resource( 'WITNESS', 'https://www.witness.org/', $directory_note ),
		twoia_direct_resource( 'Forensic Architecture', 'https://forensic-architecture.org/', $directory_note ),
		twoia_direct_resource( 'Berkeley Human Rights Center', 'https://humanrights.berkeley.edu/', $directory_note ),
		twoia_direct_resource( 'Amnesty International Crisis Evidence Lab', 'https://www.amnesty.org/en/what-we-do/crisis-evidence-lab/', $directory_note ),
		twoia_direct_resource( 'OCCRP', 'https://www.occrp.org/', $directory_note ),
		twoia_direct_resource( 'ICIJ', 'https://www.icij.org/', $directory_note ),
		twoia_direct_resource( 'ProPublica', 'https://www.propublica.org/', $directory_note ),
		twoia_direct_resource( 'Airwars', 'https://airwars.org/', $directory_note ),
		twoia_direct_resource( 'The Sentry', 'https://thesentry.org/', $directory_note ),
		twoia_direct_resource( 'Open Measures', 'https://openmeasures.io/', $directory_note ),
		twoia_direct_resource( 'OSINT Combine', 'https://www.osintcombine.com/', $directory_note ),
		twoia_direct_resource( 'OSINT Curious', 'https://osintcurio.us/', $directory_note ),
		twoia_direct_resource( 'Trace Labs', 'https://www.tracelabs.org/', $directory_note ),
		twoia_direct_resource( 'SANS Institute', 'https://www.sans.org/', $directory_note ),
		twoia_direct_resource( 'MuckRock', 'https://www.muckrock.com/', $directory_note ),
		twoia_direct_resource( 'Reporters Committee for Freedom of the Press', 'https://www.rcfp.org/', $directory_note ),
		twoia_direct_resource( 'National Security Archive', 'https://nsarchive.gwu.edu/', $directory_note ),
		twoia_direct_resource( 'Freedom of the Press Foundation', 'https://freedom.press/', $directory_note ),
		twoia_direct_resource( 'Citizen Lab', 'https://citizenlab.ca/', $directory_note ),
		twoia_direct_resource( 'Open Technology Fund', 'https://www.opentech.fund/', $directory_note ),
		twoia_direct_resource( 'OONI', 'https://ooni.org/', $directory_note ),
		twoia_direct_resource( 'Tor Project', 'https://www.torproject.org/', $directory_note ),
		twoia_direct_resource( 'Access Now', 'https://www.accessnow.org/', $directory_note ),
		twoia_direct_resource( 'Electronic Frontier Foundation', 'https://www.eff.org/', $directory_note ),
		twoia_direct_resource( 'EPIC', 'https://epic.org/', $directory_note ),
		twoia_direct_resource( 'Center for Democracy & Technology', 'https://cdt.org/', $directory_note ),
		twoia_direct_resource( 'Privacy International', 'https://privacyinternational.org/', $directory_note ),
		twoia_direct_resource( 'Open Rights Group', 'https://www.openrightsgroup.org/', $directory_note ),
		twoia_direct_resource( 'ARTICLE 19', 'https://www.article19.org/', $directory_note ),
		twoia_direct_resource( 'Fight for the Future', 'https://www.fightforthefuture.org/', $directory_note ),
		twoia_direct_resource( 'Tactical Tech', 'https://tacticaltech.org/', $directory_note ),
		twoia_direct_resource( 'Front Line Defenders', 'https://www.frontlinedefenders.org/', $directory_note ),
		twoia_direct_resource( 'DefendDefenders', 'https://defenddefenders.org/', $directory_note ),
		twoia_direct_resource( 'Internet Freedom Foundation', 'https://internetfreedom.in/', $directory_note ),
		twoia_direct_resource( 'Wikimedia Foundation', 'https://wikimediafoundation.org/', $directory_note ),
		twoia_direct_resource( 'Chaos Computer Club', 'https://www.ccc.de/en/', $directory_note ),
		twoia_direct_resource( 'Cult of the Dead Cow', 'https://cultdeadcow.com/', $directory_note ),
		twoia_direct_resource( 'Riseup', 'https://riseup.net/', $directory_note ),
		twoia_direct_resource( 'Telecomix', 'https://telecomix.org/', $directory_note ),
		twoia_direct_resource( 'Distributed Denial of Secrets', 'https://ddosecrets.com/', $directory_note ),
		twoia_direct_resource( 'WikiLeaks', 'https://wikileaks.org/', $directory_note ),
		twoia_direct_resource( 'Cryptome', 'https://cryptome.org/', $directory_note ),
		twoia_direct_resource( 'The Yes Men', 'https://theyesmen.org/', $directory_note ),
		twoia_direct_resource( 'FIRST', 'https://www.first.org/', $directory_note ),
		twoia_direct_resource( 'Shadowserver Foundation', 'https://www.shadowserver.org/', $directory_note ),
		twoia_direct_resource( 'American Civil Liberties Union', 'https://www.aclu.org/', $directory_note ),