403Webshell
Server IP : 207.135.97.11  /  Your IP : 172.19.0.1
Web Server : LiteSpeed
System : Linux 6d372a2d2e33 5.14.0-611.24.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jan 23 11:42:43 UTC 2026 x86_64
User : nobody ( 65534)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/html/ed.net.au/wp-content/plugins/wp-optimize/webp/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/ed.net.au/wp-content/plugins/wp-optimize/webp/class-wpo-webp-convert.php
<?php

if (!defined('ABSPATH')) die('No direct access allowed');

if (!class_exists('WPO_WebP_Convert')) :

/**
 * Handles WebP conversion by iterating through available converters.
 */
class WPO_WebP_Convert {

	/**
	 * @var array<string>
	 */
	private $converters = array();

	private function __construct() {
		$webp_converters = WP_Optimize()->get_options()->get_option('webp_converters');
		$this->converters = false === $webp_converters ? array() : $webp_converters;
	}

	/**
	 * Singleton instance
	 *
	 * @return WPO_WebP_Convert
	 */
	public static function get_instance(): self {
		static $instance = null;
		if (null === $instance) {
			$instance = new self();
		}
		return $instance;
	}

	/**
	 * Convert an image file to WebP format using the first available converter that succeeds.
	 *
	 * @param string $source Path of the source file.
	 * @return bool True if conversion succeeded, false otherwise.
	 */
	public function convert($source): bool {
		if (empty($this->converters)) {
			return false;
		}

		$destination = WPO_WebP_Utils::get_destination_path($source);

		return $this->attempt_conversion($source, $destination);
	}

	/**
	 * Try each configured converter in order until one produces a WebP file.
	 *
	 * @param string $source      Path of the source file.
	 * @param string $destination Path of the destination file.
	 * @return bool True if a converter produced the destination file.
	 */
	private function attempt_conversion($source, $destination): bool {
		foreach ($this->converters as $converter) {
			WPO_WebP_Utils::perform_webp_conversion($converter, $source, $destination);
			if (is_file($destination)) {
				return true;
			}
		}

		return false;
	}
}
endif;

Youez - 2016 - github.com/yon3zu
LinuXploit