PluginProbe
Posts Table with Search & Sort / 1.3
Posts Table with Search & Sort v1.3
trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2 1.3 1.3.1 1.3.1-v2 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 All 39 releases
posts-data-table / autoloader.php

autoloader.php in Posts Table with Search & Sort 1.3, at autoloader.php

46 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 spl_autoload_register( function( $class ) {
4 $namespace = 'Barn2\\Plugin\\Posts_Table_Search_Sort';
5 $src_path = __DIR__ . '/src';
6
7 // Bail if the class is not in our namespace.
8 if ( 0 !== strpos( $class, $namespace ) ) {
9 return;
10 }
11
12 // Remove the namespace.
13 $class = str_replace( $namespace, '', $class );
14
15 // Build the filename - realpath returns false if file doesn't exist.
16 $file = realpath( $src_path . '/' . str_replace( '\\', '/', $class ) . '.php' );
17
18 // If the file exists for the class name, load it.
19 if ( $file ) {
20 include_once $file;
21 }
22 }
23 );
24
25 spl_autoload_register( function( $class ) {
26 $namespace = 'Barn2\\Lib';
27 $lib_path = __DIR__ . '/lib';
28
29 // Bail if the class is not in our namespace.
30 if ( 0 !== strpos( $class, $namespace ) ) {
31 return;
32 }
33
34 // Remove the namespace.
35 $class = str_replace( $namespace, '', $class );
36
37 // Build the filename - realpath returns false if file doesn't exist.
38 $file = realpath( $lib_path . '/' . str_replace( '\\', '/', $class ) . '.php' );
39
40 // If the file exists for the class name, load it.
41 if ( $file ) {
42 include_once $file;
43 }
44 }
45 );
46