PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.5.0
Forumax – AI Powered Advanced Community Forum Plugin v2.5.0
2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 All 30 releases
← All changes | autoloader.php +37 -5 1.2.3 → 2.5.0 View file →
@@ -1,16 +1,48 @@
1 1 <?php
2 -spl_autoload_register( 'bbp_core_autoloader' );
2 +spl_autoload_register( 'forumax_autoloader' );
3 3
4 4 /**
5 - * Autoload files for the plugin
5 + * Autoload files for the Forumax plugin.
6 6 *
7 - * @param string $class
7 + * SCOPED: Only handles classes that belong to Forumax.
8 + * This prevents conflicts with other plugins' autoloaders and namespaces.
9 + *
10 + * @param string $class The fully-qualified class name.
8 11 * @return void
9 12 */
10 -function bbp_core_autoloader( $class ) {
13 +function forumax_autoloader( $class ) {
14 + // Define the namespace/class prefixes that belong to Forumax.
15 + $forumax_prefixes = array(
16 + 'admin\\', // admin\Menu, admin\Elementor\*, admin\Blocks\*, admin\menu\*
17 + 'Admin\\', // Admin\Admin_Assets
18 + 'Frontend\\', // Frontend\Frontend_Assets
19 + 'features\\', // features\bbp_voting, features\bbp_attachments, etc.
20 + );
21 +
22 + // Check if this class belongs to Forumax.
23 + $is_forumax_class = false;
24 +
25 + // Check for exact global class name (no namespace).
26 + if ( 'Admin' === $class ) {
27 + $is_forumax_class = true;
28 + } else {
29 + // Check for namespace prefixes.
30 + foreach ( $forumax_prefixes as $prefix ) {
31 + if ( strpos( $class, $prefix ) === 0 ) {
32 + $is_forumax_class = true;
33 + break;
34 + }
35 + }
36 + }
37 +
38 + // Bail early if this class doesn't belong to Forumax.
39 + if ( ! $is_forumax_class ) {
40 + return;
41 + }
42 +
11 43 $path = __DIR__ . '/includes/' . str_replace( '\\', '/', $class ) . '.php';
12 44
13 45 if ( file_exists( $path ) ) {
14 46 include_once $path;
15 47 }
16 -}
48 +}