Skip to content
wiki.fftac.org

FFTAC Media Assets

**Site relevance:** Anti-Christ.org

**Memory type:** plugin source memory

**Source path:** Anti-Christ.org/wp-content/plugins/fftac-media-assets/fftac-media-assets.php

**Size:** 1.9 KB

Summary

Plugin Name: FFTAC Media Assets

Source Preview

This source file is short enough to preview directly on its source-memory page.

<?php
/**
 * Plugin Name: FFTAC Media Assets
 * Description: Provides the large poster, wallpaper, preview, artifact-study, and press-kit files for the Antichrist Engine theme.
 * Version: 3.28.0
 * Author: Foundation For The Anti-Christ
 * Text Domain: fftac-media-assets
 *
 * @package FFTAC_Media_Assets
 */

if (!defined('ABSPATH')) {
    exit;
}

define( 'FFTAC_MEDIA_ASSETS_VERSION', '3.28.0' );
define('FFTAC_MEDIA_ASSETS_PLUGIN_FILE', __FILE__);
define('FFTAC_MEDIA_ASSETS_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('FFTAC_MEDIA_ASSETS_PLUGIN_URL', plugin_dir_url(__FILE__));

/**
 * Resolves theme download assets from this plugin when the theme copy is absent.
 *
 * The Antichrist Engine theme keeps the public page shell and catalog. This
 * plugin owns the bulky file payload so normal theme uploads can stay small.
 *
 * @param array<string, mixed> $asset Theme-provided asset descriptor.
 * @return array<string, mixed>
 */
function fftac_media_assets_resolve_foundation_asset($asset)
{
    if (!is_array($asset)) {
        return $asset;
    }

    $relative_path = ltrim((string) ($asset['relative_path'] ?? ''), '/\\');
    $path_segments = preg_split('/[\/\\\\]+/', $relative_path);

    if ('' === $relative_path || in_array('..', (array) $path_segments, true) || 0 !== strpos($relative_path, 'assets/downloads/')) {
        return $asset;
    }

    $plugin_path = FFTAC_MEDIA_ASSETS_PLUGIN_DIR . str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $relative_path);

    if (!file_exists($plugin_path)) {
        return $asset;
    }

    $asset['path']   = $plugin_path;
    $asset['url']    = FFTAC_MEDIA_ASSETS_PLUGIN_URL . str_replace('\\', '/', $relative_path);
    $asset['exists'] = true;
    $asset['source'] = 'fftac-media-assets';

    return $asset;
}
add_filter('antichrist_engine_foundation_asset', 'fftac_media_assets_resolve_foundation_asset');