PluginProbe ʕ •ᴥ•ʔ
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel / trunk
WP All Export – Drag & Drop Export to Any Custom CSV, XML & Excel vtrunk
trunk 0.9.0 0.9.1 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.2.1 1.2.10 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.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0
wp-all-export / addon-api / autoload.php
wp-all-export / addon-api Last commit date
classes 2 months ago fields 2 months ago templates 2 months ago autoload.php 2 months ago
autoload.php
50 lines
1 <?php
2
3 namespace Wpae\AddonAPI;
4
5 if ( ! defined( 'ABSPATH' ) ) exit;
6
7 require PMXE_ROOT_DIR . '/addon-api/classes/helpers.php';
8
9 class PMXE_Addon_Autoloader {
10 use Singleton;
11
12 public function __construct() {
13 spl_autoload_register( [ $this, 'autoload' ] );
14
15 foreach ( $this->modules() as $module ) {
16 $module::getInstance();
17 }
18 }
19
20 public function modules() {
21 return [];
22 }
23
24 public function loadIfFound( string $path ) {
25 $path = PMXE_ROOT_DIR . '/addon-api/' . $path . '.php';
26
27 if ( file_exists( $path ) ) {
28 require_once $path;
29 }
30 }
31
32 public function autoload( $class ) {
33 if ( strpos( $class, 'PMXE_Addon_' ) === false ) {
34 return;
35 }
36
37 $parts = explode( '\\', $class );
38 $className = end( $parts );
39 $className = str_replace( 'PMXE_Addon_', '', $className );
40 $className = str_replace( '_', '-', $className );
41 $className = strtolower( $className );
42 $className = str_replace( '-field', '', $className ); // E.g. Rename "text-field" to "text"
43
44 $this->loadIfFound( 'classes/' . $className );
45 $this->loadIfFound( 'fields/' . $className );
46 }
47 }
48
49 PMXE_Addon_Autoloader::getInstance();
50