1<?php
2
3namespace WPaaS;
4
5if ( ! defined( 'ABSPATH' ) ) {
6
7 exit;
8
9}
10
11// Use only Composer's classmap instead of the full autoloader to avoid
12// registering a global autoloader that could conflict with other plugins
13// bundling their own Composer dependencies.
14// This helps with performance by avoiding glob function call that was there prior.
15
16$wpaas_classmap = require __DIR__ . '/../../vendor/composer/autoload_classmap.php';
17
18spl_autoload_register(
19 function ( $class ) use ( $wpaas_classmap ) {
20
21 if ( strpos( $class, __NAMESPACE__ . '\\' ) === 0 && isset( $wpaas_classmap[ $class ] ) ) {
22
23 require_once $wpaas_classmap[ $class ];
24
25 }
26
27 }
28);
29
30/**
31 * Returns the plugin instance.
32 *
33 * @return Plugin
34 */
35function plugin() {
36
37 return Plugin::load();
38
39}
40