| Server IP : 127.0.1.1 / Your IP : 127.0.0.1 Web Server : Apache/2.4.52 (Ubuntu) System : Linux sealall 5.15.0-179-generic #189-Ubuntu SMP Tue May 5 18:20:56 UTC 2026 x86_64 User : devops ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/domains/sealall.ca/wp-content/plugins/automaticcss-plugin/classes/ |
Upload File : |
<?php
/**
* Automatic.css Autoloader class file.
*
* @package Automatic_CSS
*/
namespace Automatic_CSS;
defined( 'ABSPATH' ) || die( 'No script kiddies please!' );
/**
* Autoloader class.
*/
class Autoloader {
/**
* Directories to look for files in.
*
* @var array{string}
*/
public static $directories = array( 'classes', 'library' );
/**
* Try and locate the class file and load it.
*
* @param String $class_name The class name to load.
* @return void
*/
public static function autoload( $class_name ) {
// STEP: check that the class is in the plugin namespace.
if ( 0 !== strpos( $class_name, __NAMESPACE__ ) ) {
return;
}
// STEP: find the class file.
$class_name = str_replace( __NAMESPACE__ . '\\', '', $class_name );
foreach ( self::$directories as $directory ) {
$file = realpath( ACSS_PLUGIN_DIR . '/' . $directory . '/' . str_replace( '\\', '/', $class_name ) . '.php' );
if ( file_exists( $file ) ) {
// STEP: load the class file.
require_once $file; // phpcs:ignore PHPCS_SecurityAudit.Misc.IncludeMismatch.ErrMiscIncludeMismatchNoExt
return;
}
}
}
/**
* Register the autoloader.
*
* @return void
*/
public static function register() {
spl_autoload_register( array( new self(), 'autoload' ) );
}
}