| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/robotics/wp-content/plugins/wp-optimize/includes/ |
Upload File : |
<?php
if (!defined('ABSPATH')) die('Access denied.');
if (!class_exists('WPO_Page_Optimizer')) :
class WPO_Page_Optimizer {
/**
* Instance of this class
*
* @var null|WPO_Page_Optimizer
*/
private static $instance = null;
/**
* Get the buffer and perform tasks related to page optimization
*
* @param string $buffer Page HTML.
* @param int $flags OB flags to be passed through.
*
* @return string
*/
private function optimize(string $buffer, int $flags): string {
$buffer = apply_filters('wp_optimize_buffer', $buffer);
$buffer = $this->maybe_cache_page($buffer, $flags);
return $buffer;
}
/**
* Cache the page if the page cache enabled
*
* @param string $buffer Page HTML.
* @param int $flags OB flags to be passed through.
*
* @return string
*/
private function maybe_cache_page(string $buffer, int $flags): string {
if (WP_Optimize()->get_page_cache()->should_cache_page()) {
return wpo_cache($buffer, $flags);
}
return $buffer;
}
/**
* Initialise output buffer handler.
*
* @return void
*/
public function initialise() {
ob_start(array(self::$instance, 'optimize'));
}
/**
* Returns singleton instance of WPO_Page_Optimizer
*
* @return WPO_Page_Optimizer
*/
public static function instance(): WPO_Page_Optimizer {
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
}
endif;