Pages compressing

For compressing pages (if supported by browser) in the file includes/gzip.php defined class Gzip, which is automatically initialized each time the page.

Attention!
This class is a system and can not be used anywhere else.

Методы

void init () – Initiates compression. Output buffering is turned on, the necessary HTTP headers are detected and transmitted.

void do_gzip () – Provides compressed data, clears (erases) the output buffer and disables output buffering.

string ob_callback (string $buffer, string $phase) – Processes the output buffer.

  • string $buffer: contents of the output buffer
  • string $phase: bit mask of constants PHP_OUTPUT_HANDLER_*

string ob_gz_callback (string $buffer, string $phase) – Processes output buffer with data compression.

  • string $buffer: contents of the output buffer
  • string $phase: bit mask of constants PHP_OUTPUT_HANDLER_*

string minify_html (string $buffer) – HTML seal.

  • string $buffer: contents of the output buffer

string minify_html_light (string $buffer) – Embedded HTML Seal Option.

  • string $buffer: contents of the output buffer

Example:

Custom::inc('includes/gzip.php');

// start process of recording in the buffer
Gzip::init();

// ...
// program execution
// ...

// outputs the compressed data from the buffer
Gzip::do_gzip();