<?php
/**
 * Custom Fields — public integration loader.
 *
 * @package CustomFields
 */

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

/**
 * Load frontend/public integrations (shortcode, REST consumers, builders, Gutenberg).
 */
function wpps_cf_load_public_integrations(): void {
	static $loaded = false;
	if ( $loaded ) {
		return;
	}

	$dir   = __DIR__;
	$files = [
		'shortcode.php',
		'content-tags.php',
		'gutenberg.php',
		'divi.php',
		'beaver-themer.php',
	];

	foreach ( $files as $file ) {
		$path = $dir . '/' . $file;
		if ( is_readable( $path ) ) {
			require_once $path;
		}
	}

	$loaded = true;
}
