403Webshell
Server IP : 192.64.118.117  /  Your IP : 3.14.248.120
Web Server : LiteSpeed
System : Linux premium56.web-hosting.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64
User : thecgapy ( 1160)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/thecgapy/tcrgfinancesuite.com/wp-content/plugins/w3-total-cache/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/thecgapy/tcrgfinancesuite.com/wp-content/plugins/w3-total-cache/Util_UsageStatistics.php
<?php
namespace W3TC;

class Util_UsageStatistics {
	static public function bytes_to_size( $v ) {
		if ( is_null( $v ) )
			return 'n/a';
		if ( $v > 500000000 )
			return sprintf( '%.1f GB', $v / 1024 /*KB*/ / 1024 /*MB*/ / 1024/*GB*/ );
		if ( $v > 500000 )
			return sprintf( '%.1f MB', $v / 1024 /*KB*/ / 1024 /*MB*/ );
		else
			return sprintf( '%.1f KB', $v / 1024 /*KB*/ );
	}



	static public function bytes_to_size2( $a, $p1, $p2 = null, $p3 = null ) {
		$v = self::v( $a, $p1, $p2, $p3 );
		if ( is_null( $v ) )
			return 'n/a';

		return self::bytes_to_size( $v );
	}



	static public function percent( $v1, $v2 ) {
		if ( $v2 == 0 )
			return '0 %';
		else
			return sprintf( '%d', $v1 / $v2 * 100 ) . ' %';
	}



	static public function percent2( $a, $property1, $property2 ) {
		if ( !isset( $a[$property1] ) || !isset( $a[$property2] ) )
			return 'n/a';
		else if ( $a[$property2] == 0 )
				return '0 %';
			else
				return sprintf( '%d', $a[$property1] / $a[$property2] * 100 ) . ' %';
	}



	static public function sum( $history, $property ) {
		$v = 0;
		foreach ( $history as $i ) {
			if ( !empty( $i[$property] ) )
				$v += $i[$property];
		}
		return $v;
	}



	static public function time_mins( $timestamp ) {
		return date( 'm/d/Y H:i', $timestamp );
	}



	static public function integer( $v ) {
		return number_format( $v );
	}



	static public function integer2( $a, $p1, $p2 = null, $p3 = null ) {
		$v = self::v( $a, $p1, $p2, $p3 );
		if ( is_null( $v ) )
			return 'n/a';
		else
			return number_format( $v );
	}



	static public function v( $a, $p1, $p2 = null, $p3 = null ) {
		if ( !isset( $a[$p1] ) )
			return null;

		$v = $a[$p1];
		if ( is_null( $p2 ) )
			return $v;
		if ( !isset( $v[$p2] ) )
			return null;

		$v = $v[$p2];
		if ( is_null( $p3 ) )
			return $v;
		if ( !isset( $v[$p3] ) )
			return null;

		return $v[$p3];
	}



	static public function value_per_second( $a, $property1, $property2 ) {
		if ( !isset( $a[$property1] ) || !isset( $a[$property2] ) )
			return 'n/a';
		else if ( $a[$property2] == 0 )
				return '0';
			else
				return sprintf( '%.1f', $a[$property1] / $a[$property2] * 100 );
	}



	static public function value_per_period_seconds( $total, $summary ) {
		if ( empty( $summary['period']['seconds'] ) )
			return 'n/a';

		$period_seconds = $summary['period']['seconds'];

		return sprintf( '%.1f', $total / $period_seconds );
	}



	/**
	 * Special shared code for cache size counting
	 */
	static public function get_or_init_size_transient( $transient, $summary ) {
		$should_count = false;

		$v = get_transient( $transient );
		if ( is_array( $v ) && isset( $v['timestamp_end'] ) &&
			$v['timestamp_end'] == $summary['period']['timestamp_end'] ) {
			return array( $v, false );
		}

		// limit number of processing counting it at the same time
		$v = array(
			'timestamp_end' => $summary['period']['timestamp_end'],
			'size_used' => '...counting',
			'items' => '...counting'
		);
		set_transient( $transient, $v, 120 );
		return array( $v, true );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit