# double-opt-in/5.6.1/autoload.php

Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification, version 5.6.1. 39 lines.

- Page: https://pluginprobe.com/plugins/double-opt-in/5.6.1/code/autoload.php
- Raw: https://pluginprobe.com/plugins/double-opt-in/5.6.1/raw/autoload.php
- Modified: 2026-01-29T14:02:52+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/double-opt-in/5.6.1/code/autoload.php#L10-L20`.

```php
<?php
/**
 * PSR-4 Autoloader for Double Opt-In Plugin
 *
 * @package Forge12\DoubleOptIn
 * @since   4.0.0
 */

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

spl_autoload_register( function ( $class ) {
	// Project namespace prefixes and their base directories
	$namespaces = [
		'Forge12\\DoubleOptIn\\' => __DIR__ . '/src/',
	];

	foreach ( $namespaces as $prefix => $base_dir ) {
		// Check if the class uses this namespace prefix
		$len = strlen( $prefix );
		if ( strncmp( $prefix, $class, $len ) !== 0 ) {
			continue;
		}

		// Get the relative class name
		$relative_class = substr( $class, $len );

		// Replace namespace separators with directory separators
		$file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php';

		// If the file exists, require it
		if ( file_exists( $file ) ) {
			require $file;
			return;
		}
	}
} );

```
