Description
Autoloads a class if we know how to.The fact that we have gotten here means that the class is not already loaded, so we need to load it … that's assuming we haven't already tried.
Usage
OIK_Autoload::autoload( $class );Parameters
- $class
- ( mixed ) required –
Returns
voidTO DO
We should also know which pre-requisite classes to load. Does spl_autoload_register() handle this? What if we can't?Source
File name: oik/libs/class-oik-autoload.phpLines:
1 to 27 of 27
function autoload( $class ) { // Bail early if we've already tried to load this class. // This can happen if a plugin calls class_exists() multiple times // for the same class name but the class wasn't loaded. if (array_key_exists( $class, $this->tried_classes )) { $this->tried_classes[ $class ]++; return; } $this->tried_classes[ $class ] = 1; //bw_trace2( $this->tried_classes, "tried_classes", false, BW_TRACE_DEBUG ); if ( $this->autoload_shared_library ) { $library_file = $this->load_shared_library_class_file( $class ); if ( $library_file && !is_wp_error( $library_file)) { return; } } $class_file = $this->locate_class( $class ); if ( $class_file ) { $file = $this->file( $class_file ); oik_require( $file, $class_file->plugin ); } else { // Perhaps it's a shared library file // or perhaps it's in classes $this->load_shared_library_class_file( $class ); } }View on GitHub View on Trac
Called by
Invoked by
Calls
1 to 3 of 3
