| Server IP : 172.67.201.108 / Your IP : 216.73.216.101 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/home2/domains/licampfair.com/wp-content/plugins/kali-forms/ |
Upload File : |
<?php
namespace KaliForms;
if ( ! defined( 'ABSPATH' ) ) {
die;
}
/**
* Class KaliForms_Autoloader
*/
class KaliForms_Autoloader {
/**
* KaliForms_Autoloader constructor.
*/
public function __construct() {
spl_autoload_register( [ $this, 'load' ] );
}
/**
* Load the class name
*
* @param string $filename
*/
public function load( $filename = '' ) {
/**
* Explode namespace
* (SPL AUTOLOAD REGISTER receives something like Inc/KaliForms or Inc/Console/Command)
*/
$fp = explode( '\\', $filename );
$cf = $this->format_class_name( $fp );
/**
* Get plugin root
*/
$path = trailingslashit( dirname( __FILE__ ) );
/**
* Build path based on the explode from before
*/
for ( $i = 1; $i < count( $fp ) - 1; $i ++ ) {
$path .= trailingslashit( $fp[ $i ] );
}
/**
* Append class name
*/
$path .= $cf;
$this->include_file( $path );
}
/**
* Include file
*
* @param string $path
*/
public function include_file( $path = '' ) {
/**
* If it exists, include it.
*/
if ( file_exists( $path ) ) {
include_once $path;
}
}
/**
* Formats the class name and returns it
*
* @param array $fp
*
* @return string
*/
public function format_class_name( $fp = [] ) {
$cf = '';
/**
* We need to get the last index, that's the class name
*/
if ( isset( $fp[ count( $fp ) - 1 ] ) ) {
/**
* turn it lowercase
*/
$cf = strtolower( $fp[ count( $fp ) - 1 ] );
/**
* Format class file according to standards
*/
$cf = str_ireplace( '_', '-', $cf );
/**
* prepend class-
*/
$cf = sprintf( 'class-%s.php', $cf );
}
return $cf;
}
}
new KaliForms_Autoloader();