HEX
Server: LiteSpeed
System: Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User: swifizcd (1555)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/swifizcd/julnohub.com.ng/wp-content/plugins/head-footer-code/classes/autoload.php
<?php

namespace Techwebux\Hfc;

// If this file is called directly, abort.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

spl_autoload_register( __NAMESPACE__ . '\autoload' );

/**
 * Autoload function for Techwebux\Hfc classes.
 *
 * @param string $class_name The fully qualified class name.
 * @return bool True if class was loaded, false otherwise.
 */
function autoload( $class_name ) {
	// Ensure the class belongs to the current namespace.
	if (
		empty( $class_name )
		|| 0 !== strpos( $class_name, __NAMESPACE__ . '\\' )
	) {
		// Not our namespace, bail out.
		return false;
	}

	// Replace underscores with dashes and convert class name to lowercase, then split.
	$components = explode(
		'\\',
		str_replace( '_', '-', strtolower( $class_name ) )
	);

	// Replace last component with composed class filename.
	$components[] = 'class-' . array_pop( $components ) . '.php';

	// Define class real path.
	$class_path = realpath( __DIR__ . DIRECTORY_SEPARATOR . implode( DIRECTORY_SEPARATOR, $components ) );

	// Check if the class file exists within the plugin directory before including.
	if ( ! empty( $class_path ) && file_exists( $class_path ) ) {
		// We already making sure that file is exists and valid.
		require_once $class_path; // phpcs:ignore
		return true;
	}
	return false;
} // END function autoload