https://t.me/RX1948
Server : nginx/1.24.0
System : Linux ip-172-31-33-48 6.14.0-1011-aws #11~24.04.1-Ubuntu SMP Fri Aug 1 02:07:25 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
Directory :  /var/www/html/wp-content/plugins.off/ninjafirewall/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/wp-content/plugins.off/ninjafirewall/lib/class-helpers.php
<?php
/*
 +=====================================================================+
 |    _   _ _        _       _____ _                        _ _        |
 |   | \ | (_)_ __  (_) __ _|  ___(_)_ __ _____      ____ _| | |       |
 |   |  \| | | '_ \ | |/ _` | |_  | | '__/ _ \ \ /\ / / _` | | |       |
 |   | |\  | | | | || | (_| |  _| | | | |  __/\ V  V / (_| | | |       |
 |   |_| \_|_|_| |_|/ |\__,_|_|   |_|_|  \___| \_/\_/ \__,_|_|_|       |
 |                |__/                                                 |
 |  (c) NinTechNet Limited ~ https://nintechnet.com/                   |
 +=====================================================================+
*/

if ( class_exists('NinjaFirewall_helpers') ) {
	return;
}

class NinjaFirewall_helpers {


	/**
	 * Retrieve and return matching files from a directory.
	 * Replacement for the PHP glob() function to make file search compatible with remote files.
	 */
	public static function nfw_glob( $directory, $regex, $pathname = false, $sortname = true ) {

		$list = [];

		foreach ( new DirectoryIterator( $directory ) as $finfo ) {
			if (! $finfo->isDot() && preg_match("`$regex`", $finfo->getFilename() ) ) {
				if ( $pathname ) {
					$list[] = $finfo->getPathname();
				} else {
					$list[] = $finfo->getFilename();
				}
			}
		}
		if ( $sortname === true ) {
			asort( $list );
		}

		return $list;
	}


	/**
	 * Retrieve and return matching files from a directory, recursively.
	 * Replacement for the PHP glob() function to make file search compatible with remote files.
	 */
	public static function nfw_glob_recursive( $directory, $regex, $pathname = false ) {

		$list = [];

		$dir_iterator = new RecursiveDirectoryIterator( $directory );
		$iterator = new RecursiveIteratorIterator( $dir_iterator );

		foreach ( $iterator as $finfo ) {
			if ( preg_match("`$regex`", $finfo->getFilename() ) ) {
				if ( $pathname ) {
					$list[] = $finfo->getPathname();
				} else {
					$list[] = $finfo->getFilename();
				}
			}
		}
		return $list;
	}

}

// ---------------------------------------------------------------------
// EOF

https://t.me/RX1948 - 2025