403Webshell
Server IP : 89.108.64.180  /  Your IP : 216.73.216.140
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux 89-108-64-180.cloudvps.regruhosting.ru 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : www-root ( 1010)
PHP Version : 8.0.30
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/жемчужина.online/wp-content/plugins/mphb-reviews/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/жемчужина.online/wp-content/plugins/mphb-reviews/includes/autoloader.php
<?php

namespace MPHBR;

class Autoloader {

	/**
	 *
	 * @var string
	 */
	private $prefix;

	/**
	 *
	 * @var int
	 */
	private $prefixLength;

	/**
	 *
	 * @var string
	 */
	private $basePath;

	/**
	 *
	 * @var string
	 */
	private $classDirSeparator;
	private $customPathList = array();

	/**
	 *
	 * @param string $prefix   Class prefix.
	 * @param string $basePath Path to classes directory.
	 */
	public function __construct( $prefix, $basePath ) {

		$this->prefix       = $prefix;
		$this->prefixLength = strlen( $this->prefix );
		$this->basePath     = $basePath;

		$this->classDirSeparator = '\\'; // namespaces

		$this->setupCustomPathList();

		spl_autoload_register( array( $this, 'autoload' ) );
	}

	private function setupCustomPathList() {
		$this->customPathList['Libraries\\EDD_Plugin_Updater\\EDD_Plugin_Updater'] = 'libraries/edd-plugin-updater/edd-plugin-updater.php';
	}

	/**
	 *
	 * @param string $class
	 *
	 * @return string|boolean filepath or false
	 */
	public function autoload( $class ) {

		$class = ltrim( $class, '\\' );

		// does the class use the namespace prefix?
		if ( strncmp( $this->prefix, $class, $this->prefixLength ) !== 0 ) {
			// no, move to the next registered autoloader
			return false;
		}

		$relativeClass = substr( $class, $this->prefixLength );

		// replace the namespace prefix with the base directory, replace namespace
		// separators with directory separators in the relative class name, append
		// with .php
		$file = $this->basePath . $this->convertClassToPath( $relativeClass );

		// if the file exists, require it
		if ( file_exists( $file ) ) {
			require_once $file;

			return $file;
		}

		return false;
	}

	/**
	 *
	 * @param string $class
	 *
	 * @return string Relative path to classfile.
	 */
	private function convertClassToPath( $class ) {
		$path = '';

		if ( array_key_exists( $class, $this->customPathList ) ) {
			$path = $this->customPathList[ $class ];
		} else {
			$path = $this->defaultConvert( $class );
		}

		return $path;
	}

	private function defaultConvert( $class ) {

		$filePath = $this->convertToFilePath( $class );
		$filePath = $this->lowerCamelCase( $filePath );
		$filePath = $this->replaceUnderscores( $filePath );

		return $filePath;
	}

	private function replaceUnderscores( $path ) {
		return str_replace( '_', '-', $path );
	}

	private function lowerCamelCase( $class ) {
		$class = preg_replace( '/([a-z])([A-Z])/', '$1-$2', $class );
		$class = preg_replace( '/([A-Z])([A-Z][a-z])/', '$1-$2', $class );
		$class = strtolower( $class );

		return $class;
	}

	private function convertToFilePath( $class ) {

		$classFile = str_replace( $this->classDirSeparator, DIRECTORY_SEPARATOR, $class );

		$classFile = $classFile . '.php';

		return $classFile;
	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit