GRAYBYTE WORDPRESS FILE MANAGER7133

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/giriqfky/chahida.co.in/wp-content/plugins/wp-optimize/webp/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/giriqfky/chahida.co.in/wp-content/plugins/wp-optimize/webp//class-wpo-webp-self-test.php
<?php

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

if (!class_exists('WPO_WebP_Self_Test')) :

class WPO_WebP_Self_Test {

	/**
	 * Determines whether content type header has webp mime or not
	 *
	 * @param array $headers An array of headers
	 *
	 * @return bool
	 */
	private function has_webp_mime($headers) {
		return isset($headers['content-type']) && 0 === strcasecmp('image/webp', $headers['content-type']);
	}

	/**
	 * Determines whether headers has `vary` header or not
	 *
	 * @param array $headers An array of headers
	 *
	 * @return bool
	 */
	private function has_vary($headers) {
		return isset($headers['vary']) && preg_match('/accept/i', $headers['vary']);
	}

	/**
	 * Decided whether webp version is served or not
	 *
	 * @return bool
	 */
	public function is_webp_served() {
		$args = array(
			'headers' => array(
				'accept' => 'image/webp'
			)
		);

		$upload_dir = wp_upload_dir();
		$url =  $upload_dir['baseurl']. '/wpo/images/wpo_logo_small.png';

		$response = wp_remote_head($url, $args);

		if (is_wp_error($response)) return false;
		if (200 != $response['response']['code']) return false;

		$headers = wp_remote_retrieve_headers($response);
		if (method_exists($headers, 'getAll')) {
			$headers = $headers->getAll();
			if ($this->has_webp_mime($headers) && $this->has_vary($headers)) {
				return true;
			}
		}
		return false;
	}

	/**
	 * Returns singleton instance
	 *
	 * @return WPO_WebP_Self_Test
	 */
	public static function get_instance() {
		static $_instance = null;
		if (null === $_instance) {
			$_instance = new self();
		}
		return $_instance;
	}
}

endif;

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 10 2025 04:32:24
giriqfky / giriqfky
0755
.htaccess
0.41 KB
July 10 2025 04:32:24
giriqfky / giriqfky
0644
class-wp-optimize-webp-images.php
3.242 KB
March 13 2023 19:14:32
giriqfky / giriqfky
0644
class-wp-optimize-webp.php
15.646 KB
May 01 2025 14:24:58
giriqfky / giriqfky
0644
class-wpo-htaccess-capabilities.php
1.648 KB
June 21 2022 03:11:04
giriqfky / giriqfky
0644
class-wpo-server-info.php
1.898 KB
June 03 2022 22:20:18
giriqfky / giriqfky
0644
class-wpo-webp-alter-html.php
4.627 KB
September 16 2024 16:17:24
giriqfky / giriqfky
0644
class-wpo-webp-convert.php
1.353 KB
July 06 2023 16:18:20
giriqfky / giriqfky
0644
class-wpo-webp-self-test.php
1.589 KB
October 16 2023 19:36:50
giriqfky / giriqfky
0644
class-wpo-webp-test-run.php
1.316 KB
July 06 2023 16:18:20
giriqfky / giriqfky
0644
class-wpo-webp-utils.php
2.517 KB
May 01 2025 14:24:58
giriqfky / giriqfky
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF