PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.0.13
Kirki – Freeform Page Builder, Website Builder & Customizer v6.0.13
6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / customizer / packages / autoload.php
kirki / customizer / packages Last commit date
compatibility 1 month ago controls 2 months ago fields 2 months ago modules 2 months ago utils 3 weeks ago autoload.php 5 months ago index.php 5 months ago
autoload.php
74 lines
1 <?php
2 /**
3 * Lightweight PSR-4 autoloader for Kirki packages.
4 *
5 * This replaces the per-package Composer vendor folders so we only keep
6 * one shared autoloader and source files to reduce build size.
7 */
8
9 defined( 'ABSPATH' ) || exit;
10
11 // Prevent registering multiple times.
12 if ( defined( 'KIRKI_AUTOLOAD_REGISTERED' ) ) {
13 return;
14 }
15
16 define( 'KIRKI_AUTOLOAD_REGISTERED', true );
17
18 $packages = array(
19 'headline-divider' => 'HeadlineDivider',
20 'input-slider' => 'InputSlider',
21 'margin-padding' => 'MarginPadding',
22 'responsive' => 'Responsive',
23 'tabs' => 'Tabs',
24 );
25
26 $base_dir = __DIR__ . '/controls/';
27
28 $psr4_map = array(
29 'Kirki\\Control\\' => array(),
30 'Kirki\\Field\\' => array(),
31 );
32
33 foreach ( $packages as $slug => $namespace ) {
34 $package_base = $base_dir . $slug;
35
36 $control_dir = $package_base . '/src/Control';
37 if ( is_dir( $control_dir ) ) {
38 $psr4_map['Kirki\\Control\\'][] = $control_dir;
39 }
40
41 $field_dir = $package_base . '/src/Field';
42 if ( is_dir( $field_dir ) ) {
43 $psr4_map['Kirki\\Field\\'][] = $field_dir;
44 }
45
46 $root_dir = $package_base . '/src';
47 if ( is_dir( $root_dir ) ) {
48 $psr4_map[ 'Kirki\\' . $namespace . '\\' ][] = $root_dir;
49 }
50 }
51
52 spl_autoload_register(
53 function ( $class ) use ( $psr4_map ) {
54 foreach ( $psr4_map as $prefix => $directories ) {
55 if ( 0 !== strpos( $class, $prefix ) ) {
56 continue;
57 }
58
59 $relative_class = substr( $class, strlen( $prefix ) );
60 $relative_path = str_replace( '\\', '/', $relative_class ) . '.php';
61
62 foreach ( $directories as $directory ) {
63 $file = $directory . '/' . $relative_path;
64
65 if ( file_exists( $file ) ) {
66 require_once $file;
67 return;
68 }
69 }
70 }
71 }
72 );
73
74