# bbp-core/2.5.0/autoloader.php

Forumax – AI Powered Advanced Community Forum Plugin, version 2.5.0. 48 lines.

- Page: https://pluginprobe.com/plugins/bbp-core/2.5.0/code/autoloader.php
- Raw: https://pluginprobe.com/plugins/bbp-core/2.5.0/raw/autoloader.php
- Modified: 2026-04-10T15:32:42+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/bbp-core/2.5.0/code/autoloader.php#L10-L20`.

```php
<?php
spl_autoload_register( 'forumax_autoloader' );

/**
 * Autoload files for the Forumax plugin.
 *
 * SCOPED: Only handles classes that belong to Forumax.
 * This prevents conflicts with other plugins' autoloaders and namespaces.
 *
 * @param string $class The fully-qualified class name.
 * @return void
 */
function forumax_autoloader( $class ) {
	// Define the namespace/class prefixes that belong to Forumax.
	$forumax_prefixes = array(
		'admin\\',      // admin\Menu, admin\Elementor\*, admin\Blocks\*, admin\menu\*
		'Admin\\',      // Admin\Admin_Assets
		'Frontend\\',   // Frontend\Frontend_Assets
		'features\\',   // features\bbp_voting, features\bbp_attachments, etc.
	);

	// Check if this class belongs to Forumax.
	$is_forumax_class = false;

	// Check for exact global class name (no namespace).
	if ( 'Admin' === $class ) {
		$is_forumax_class = true;
	} else {
		// Check for namespace prefixes.
		foreach ( $forumax_prefixes as $prefix ) {
			if ( strpos( $class, $prefix ) === 0 ) {
				$is_forumax_class = true;
				break;
			}
		}
	}

	// Bail early if this class doesn't belong to Forumax.
	if ( ! $is_forumax_class ) {
		return;
	}

	$path = __DIR__ . '/includes/' . str_replace( '\\', '/', $class ) . '.php';

	if ( file_exists( $path ) ) {
		include_once $path;
	}
}
```
