GRAYBYTE WORDPRESS FILE MANAGER8199

Server IP : 68.65.123.43 / Your IP : 216.73.216.162
System : Linux server266.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
PHP Version : 8.0.30
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/inteuuod/public_html/wp-content/plugins/image-optimization/classes/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/inteuuod/public_html/wp-content/plugins/image-optimization/classes//file-utils.php
<?php

namespace ImageOptimization\Classes;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

class File_Utils {
	public static function get_extension( string $path ): string {
		$locale = new Locale();
		$locale->set_utf_locale();

		$extension = pathinfo( $path, PATHINFO_EXTENSION );

		$locale->reset_to_original();

		return $extension;
	}

	public static function get_basename( string $path ): string {
		$locale = new Locale();
		$locale->set_utf_locale();

		$basename = pathinfo( $path, PATHINFO_BASENAME );

		$locale->reset_to_original();

		return $basename;
	}

	public static function replace_extension( string $path, string $new_extension, bool $unique_filename = false ): string {
		$locale = new Locale();
		$locale->set_utf_locale();

		$path = pathinfo( $path );
		$basename = sprintf( '%s.%s', $path['filename'], $new_extension );

		if ( $unique_filename ) {
			$basename = wp_unique_filename( $path['dirname'], $basename );
		}

		$locale->reset_to_original();

		return sprintf( '%s/%s', $path['dirname'], $basename );
	}

	public static function get_unique_path( string $path ): string {
		$locale = new Locale();
		$locale->set_utf_locale();

		$path = pathinfo( $path );
		$basename = sprintf( '%s.%s', $path['filename'], $path['extension'] );

		$locale->reset_to_original();

		return sprintf( '%s/%s', $path['dirname'], wp_unique_filename( $path['dirname'], $basename ) );
	}

	public static function get_relative_upload_path( string $path ): string {
		$locale = new Locale();
		$locale->set_utf_locale();

		$path = _wp_relative_upload_path( $path );

		$locale->reset_to_original();

		return $path;
	}

	public static function get_url_from_path( string $full_path ): string {
		$locale = new Locale();
		$locale->set_utf_locale();

		$upload_info = wp_upload_dir();
		$url_base = $upload_info['baseurl'];

		$parts = preg_split(
			'/\/wp-content\/uploads/',
			$full_path
		);

		$locale->reset_to_original();

		return $url_base . $parts[1];
	}

	public static function format_file_size( int $file_size_in_bytes, $decimals = 2 ): string {
		$sizes = [
			__( '%s Bytes', 'image-optimization' ),
			__( '%s Kb', 'image-optimization' ),
			__( '%s Mb', 'image-optimization' ),
			__( '%s Gb', 'image-optimization' ),
		];

		if ( ! $file_size_in_bytes ) {
			return sprintf( $sizes[0], 0 );
		}

		$current_scale = floor( log( $file_size_in_bytes ) / log( 1024 ) );
		$formatted_value = number_format( $file_size_in_bytes / pow( 1024, $current_scale ), $decimals );

		return sprintf( $sizes[ $current_scale ], $formatted_value );
	}
}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
async-operation
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
client
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
exceptions
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
file-system
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
image
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
migration
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
rest
--
July 10 2025 04:32:23
inteuuod / inteuuod
0755
.htaccess
0.41 KB
July 10 2025 04:32:23
inteuuod / inteuuod
0644
basic-enum.php
0.683 KB
February 06 2024 19:05:42
inteuuod / inteuuod
0644
file-utils.php
2.531 KB
February 06 2024 19:05:42
inteuuod / inteuuod
0644
locale.php
0.563 KB
February 06 2024 19:05:42
inteuuod / inteuuod
0644
logger.php
0.856 KB
February 06 2024 19:05:42
inteuuod / inteuuod
0644
module-base.php
7.1 KB
March 05 2024 17:32:40
inteuuod / inteuuod
0644
route.php
11.064 KB
February 06 2024 19:05:42
inteuuod / inteuuod
0644
utils.php
3.132 KB
October 01 2024 15:04:24
inteuuod / inteuuod
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF