PATH:
home
/
lab2454c
/
credityork.com
/
wp-content
/
plugins
/
wp-optimize
/
webp
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); if (!class_exists('WPO_WebP_Self_Test')) : class WPO_WebP_Self_Test { /** * Decided whether we can get a webp image or not * * @return bool */ public function get_webp_image() { $args = array( 'headers' => array( 'accept' => 'image/webp' ) ); $upload_dir = wp_upload_dir(); $url = $upload_dir['baseurl']. '/wpo/images/wpo_logo_small.png.webp'; $response = wp_remote_get($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 (isset($headers['content-type']) && 'image/webp' == $headers['content-type']) { return true; } } return false; } /** * 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_get($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 (isset($headers['content-type']) && 'image/webp' == $headers['content-type']) { 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;
[+]
..
[-] class-wpo-htaccess-capabilities.php
[edit]
[-] class-wpo-webp-cron-scheduler.php
[edit]
[-] class-wpo-server-info.php
[edit]
[-] class-wpo-webp-self-test.php
[edit]
[-] class-wp-optimize-webp.php
[edit]
[-] class-wpo-webp-convert.php
[edit]
[-] class-wpo-webp-alter-html.php
[edit]
[-] class-wpo-webp-test-run.php
[edit]
[-] class-wp-optimize-webp-images.php
[edit]