Antichrist Content System Implementation - Source Excerpt 07
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
foreach ( $fr_paths as $key => $value ) {
if ( isset( $map[ $key ] ) ) {
$map[ $key ]['fr'] = $value;
}
}
return $map;
}
/**
* Translate stored menu labels for seeded navigation.
*
* @param string $title Menu item title.
* @param WP_Post $menu_item Menu item object.
* @param stdClass $args Menu args.
* @param int $depth Menu depth.
* @return string
*/
function acn_cs_translate_nav_menu_item_title( $title, $menu_item, $args, $depth ) {
unset( $args, $depth );
$key = '';
if ( $menu_item instanceof WP_Post && 'post_type' === $menu_item->type && 'page' === $menu_item->object && ! empty( $menu_item->object_id ) ) {
$page = get_post( (int) $menu_item->object_id );
if ( $page instanceof WP_Post ) {
$map = array(
'archive' => 'acn.nav.archive',
'start-here' => 'acn.nav.start',
'research-library' => 'acn.nav.library',
'message-board' => 'acn.nav.board',
'timeline' => 'acn.nav.timeline',
'symbols' => 'acn.nav.symbols',
'apocalyptic-ai' => 'acn.nav.ai',
'state-and-religion' => 'acn.nav.state_religion',
'surveillance' => 'acn.nav.surveillance',
'community-baseline' => 'acn.nav.community_baseline',
'about' => 'acn.nav.about',
'topics' => 'acn.nav.topics',
'research-agenda' => 'acn.nav.research_agenda',
'current-antichrist-cults' => 'acn.nav.current_antichrist_cults',
'antichrist-militia-groups' => 'acn.nav.antichrist_militia_groups',
'pre-christian-antichrist-history' => 'acn.nav.pre_christian_antichrist_history',
'antichrist-like-figures-eastern-philosophy' => 'acn.nav.eastern_antichrist_figures',
'antichrist-as-redeemer-of-mankind' => 'acn.nav.redeemer_mankind',
'members' => 'acn.nav.members',
);
if ( isset( $map[ $page->post_name ] ) ) {
$key = $map[ $page->post_name ];
}
}
}
if ( '' === $key ) {
$label_map = array(
'Home' => 'acn.nav.home',
'Archive' => 'acn.nav.archive',
'Start' => 'acn.nav.start',
'Library' => 'acn.nav.library',
'Board' => 'acn.nav.board',
'Message Board' => 'acn.nav.message_board',
'Timeline' => 'acn.nav.timeline',
'Symbols' => 'acn.nav.symbols',
'Apocalyptic AI' => 'acn.nav.ai',
'State & Religion' => 'acn.nav.state_religion',
'Surveillance' => 'acn.nav.surveillance',
'Community Baseline' => 'acn.nav.community_baseline',
'About' => 'acn.nav.about',
'Topics Directory' => 'acn.nav.topics',
'Research Agenda' => 'acn.nav.research_agenda',
'Research Library' => 'acn.nav.research_library',
'Current Antichrist Cults' => 'acn.nav.current_antichrist_cults',
'Antichrist Militia Groups' => 'acn.nav.antichrist_militia_groups',
'Pre-Christian Antichrist History' => 'acn.nav.pre_christian_antichrist_history',
'Antichrist-Like Figures in Eastern Philosophy' => 'acn.nav.eastern_antichrist_figures',
'Antichrist as Redeemer of Mankind' => 'acn.nav.redeemer_mankind',
'Members' => 'acn.nav.members',
);
if ( isset( $label_map[ $title ] ) ) {
$key = $label_map[ $title ];
}
}
return '' !== $key ? acn_cs_t( $key, $title ) : $title;
}
/**
* Return the active locale repository class.
*
* @return string
*/
function acn_cs_locale_repository_class() {
if ( class_exists( '\UAIXLocaleRouter\LocaleRepository' ) ) {
return '\UAIXLocaleRouter\LocaleRepository';
}
if ( class_exists( '\Ns12LocaleRouter\LocaleRepository' ) ) {
return '\Ns12LocaleRouter\LocaleRepository';
}
return '';
}
/**
* Return the active dictionary repository class.
*
* @return string
*/
function acn_cs_dictionary_repository_class() {
if ( class_exists( '\UAIXLocaleRouter\DictionaryRepository' ) ) {
return '\UAIXLocaleRouter\DictionaryRepository';
}
if ( class_exists( '\Ns12LocaleRouter\DictionaryRepository' ) ) {
return '\Ns12LocaleRouter\DictionaryRepository';
}
return '';
}
/**
* Return enabled locale records for dictionary generation.
*
* @return array
*/
function acn_cs_dictionary_locale_records() {
$locale_repository = acn_cs_locale_repository_class();
if ( '' !== $locale_repository ) {
$records = $locale_repository::get_enabled_locales();
if ( is_array( $records ) && ! empty( $records ) ) {
return $records;
}
}
return array(
array(
'tag' => 'en-US',
'urlTag' => 'en-us',
'nativeName' => 'English (United States)',
),
array(
'tag' => 'es-US',
'urlTag' => 'es-us',
'nativeName' => 'Español (Estados Unidos)',
),
array(
'tag' => 'fr-FR',
'urlTag' => 'fr-fr',
'nativeName' => 'Francais (France)',
),
array(
'tag' => 'zh-CN',
'urlTag' => 'zh-cn',
'nativeName' => '简体中文(中国)',
),
);
}
/**
* Locale tags that must be enabled and covered by every deployment test.
*
* @return array
*/
function acn_cs_required_locale_tags() {
return array( 'en-US', 'es-US', 'fr-FR', 'zh-CN' );
}
/**
* Default record for a required locale.
*
* @param string $tag Locale tag.
* @return array
*/
function acn_cs_required_locale_record( $tag ) {
if ( 'es-US' === $tag ) {
return array(
'tag' => 'es-US',
'urlTag' => 'es-us',
'language' => 'Spanish',
'nativeName' => 'Español (Estados Unidos)',
'region' => 'US',
'script' => 'Latn',
'isRtl' => false,
'enabled' => true,
'isDefault' => false,
'fallback' => 'en-US',
);
}
if ( 'fr-FR' === $tag ) {
return array(
'tag' => 'fr-FR',
'urlTag' => 'fr-fr',
'language' => 'French',
'nativeName' => 'Francais (France)',
'region' => 'FR',
'script' => 'Latn',
'isRtl' => false,
'enabled' => true,
'isDefault' => false,
'fallback' => 'en-US',
);
}
if ( 'zh-CN' === $tag ) {
return array(
'tag' => 'zh-CN',
'urlTag' => 'zh-cn',
'language' => 'Chinese',
'nativeName' => '简体中文(中国)',
'region' => 'CN',
'script' => 'Hans',
'isRtl' => false,
'enabled' => true,
'isDefault' => false,
'fallback' => 'en-US',
);
}
return array(
'tag' => 'en-US',
'urlTag' => 'en-us',
'language' => 'English',
'nativeName' => 'English (United States)',
'region' => 'US',
'script' => 'Latn',
'isRtl' => false,
'enabled' => true,
'isDefault' => true,
'fallback' => 'en-US',
);
}
/**
* Detect stale locale-router settings even when the stored deployment version is current.
*
* @param string $locale_repository Locale repository class.
* @return bool
*/
function acn_cs_locale_router_needs_config( $locale_repository ) {
if ( '' === $locale_repository ) {
return false;
}
$required = acn_cs_required_locale_tags();
$enabled = array();
$default = '';
$locales = $locale_repository::get_supported_locales();
if ( ! is_array( $locales ) || empty( $locales ) ) {
return true;
}
foreach ( $locales as $locale ) {
if ( ! is_array( $locale ) || empty( $locale['tag'] ) ) {
continue;
}
$tag = (string) $locale['tag'];
if ( ! empty( $locale['enabled'] ) ) {
$enabled[] = $tag;
}
if ( ! empty( $locale['isDefault'] ) ) {
$default = $tag;
}
if ( in_array( $tag, $required, true ) ) {
$expected = acn_cs_required_locale_record( $tag );
foreach ( array( 'enabled', 'isDefault', 'urlTag', 'fallback' ) as $key ) {
if ( ! array_key_exists( $key, $locale ) || $locale[ $key ] !== $expected[ $key ] ) {
return true;
}
}
}
}
sort( $enabled );
$required_sorted = $required;
sort( $required_sorted );
if ( $enabled !== $required_sorted || 'en-US' !== $default ) {
return true;
}
$option_prefix = class_exists( '\UAIXLocaleRouter\LocaleRepository' ) ? 'uaixlr' : 'ns12lr';
if ( 'en-US' !== get_option( $option_prefix . '_default_locale' ) ) {
return true;
}
$settings = (array) get_option( $option_prefix . '_settings', array() );
foreach (
array(
'enabled' => true,
'default_locale' => 'en-US',
'url_casing_strategy' => 'lowercase',
'trailing_slash_strategy' => 'always',
'redirect_bare_urls' => false,
'content_link_rewriting' => true,
) as $key => $value
) {
if ( ! array_key_exists( $key, $settings ) || $settings[ $key ] !== $value ) {
return true;
}
}
return false;
}
/**
* Return the translation array key for a locale.
*
* @param string $locale Locale tag.
* @return string
*/
function acn_cs_translation_language_key( $locale ) {
$locale = strtolower( (string) $locale );
if ( 0 === strpos( $locale, 'es' ) ) {
return 'es';
}
if ( 0 === strpos( $locale, 'fr' ) ) {
return 'fr';
}
if ( 0 === strpos( $locale, 'zh' ) ) {
return 'zh';
}
return 'en';
}