HEX
Server: Apache
System: Linux web5.visualcom.es 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: ensaco.es (10019)
PHP: 8.3.32
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/ensaco.es/httpdocs/wp-content/plugins/snapshot-backups/lib/loader.php
<?php // phpcs:ignore
/**
 * Snapshot autoloader
 *
 * @package snapshot
 */

/**
 * Class name to file mapping procedure
 *
 * @param string $class_name Class name.
 */
function snapshot_resolve_class( $class_name ) {
	$matches = array();

	if ( ! preg_match( '/^WPMUDEV\\\\Snapshot4\\\\(.+)$/', $class_name, $matches ) ) {
		return false;
	}

	$class_name = $matches[1];
	$raw        = explode( '\\', strtolower( $class_name ) );

	if ( false !== strpos( $class_name, 'Traits' ) ) {
		$file = 'trait-' . array_pop( $raw ) . '.php';
	} elseif ( false !== strpos( $class_name, '_' ) ) {
			$file = 'class-' . str_replace( '_', '-', array_pop( $raw ) ) . '.php';
	} else {
		$file = 'class-' . array_pop( $raw ) . '.php';
	}

	$path = __DIR__ . '/snapshot/' . join( DIRECTORY_SEPARATOR, $raw ) . "/{$file}";

	if ( is_readable( $path ) ) {
		require_once $path;
	}
}

spl_autoload_register( 'snapshot_resolve_class' );