ActionScheduler::autoload()public staticWC 1.0

Method of the class: ActionScheduler{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = ActionScheduler::autoload( $class );
$class (required)
-

ActionScheduler::autoload() code WC 9.3.3

public static function autoload( $class ) {
	$d           = DIRECTORY_SEPARATOR;
	$classes_dir = self::plugin_path( 'classes' . $d );
	$separator   = strrpos( $class, '\\' );
	if ( false !== $separator ) {
		if ( 0 !== strpos( $class, 'Action_Scheduler' ) ) {
			return;
		}
		$class = substr( $class, $separator + 1 );
	}

	if ( 'Deprecated' === substr( $class, -10 ) ) {
		$dir = self::plugin_path( 'deprecated' . $d );
	} elseif ( self::is_class_abstract( $class ) ) {
		$dir = $classes_dir . 'abstracts' . $d;
	} elseif ( self::is_class_migration( $class ) ) {
		$dir = $classes_dir . 'migration' . $d;
	} elseif ( 'Schedule' === substr( $class, -8 ) ) {
		$dir = $classes_dir . 'schedules' . $d;
	} elseif ( 'Action' === substr( $class, -6 ) ) {
		$dir = $classes_dir . 'actions' . $d;
	} elseif ( 'Schema' === substr( $class, -6 ) ) {
		$dir = $classes_dir . 'schema' . $d;
	} elseif ( strpos( $class, 'ActionScheduler' ) === 0 ) {
		$segments = explode( '_', $class );
		$type = isset( $segments[ 1 ] ) ? $segments[ 1 ] : '';

		switch ( $type ) {
			case 'WPCLI':
				$dir = $classes_dir . 'WP_CLI' . $d;
				break;
			case 'DBLogger':
			case 'DBStore':
			case 'HybridStore':
			case 'wpPostStore':
			case 'wpCommentLogger':
				$dir = $classes_dir . 'data-stores' . $d;
				break;
			default:
				$dir = $classes_dir;
				break;
		}
	} elseif ( self::is_class_cli( $class ) ) {
		$dir = $classes_dir . 'WP_CLI' . $d;
	} elseif ( strpos( $class, 'CronExpression' ) === 0 ) {
		$dir = self::plugin_path( 'lib' . $d . 'cron-expression' . $d );
	} elseif ( strpos( $class, 'WP_Async_Request' ) === 0 ) {
		$dir = self::plugin_path( 'lib' . $d );
	} else {
		return;
	}

	if ( file_exists( $dir . "{$class}.php" ) ) {
		include( $dir . "{$class}.php" );
		return;
	}
}