CodeIgniter 1.7.2 версия, и мне очень странно, что hook ==> display_override не работает.
Я проверил другие крючки ==> pre_controller, post_controller, который работал префектом, но только проблема с этим hook ==> display_override не работает.
Я проверил этот крюк, чтобы вставить die() в функцию обратного вызова крюка, который не вызывает. (функция обратного вызова())
Я работаю над оптимизацией HTML, как показано ниже. пожалуйста, любая идея
Каталог: -
1) приложение/Config/config.php
$config['enable_hooks'] = TRUE;
=================== ===================== 2) приложение/Config/hooks.php
$hook['display_override'][] = array(
'class' => 'Minifyhtml',
'function' => 'output',
'filename' => 'Minifyhtml.php',
'filepath' => 'hooks',
'params' => array()
);
=========== ================================
3) применение/Крючки/Minifyhtml.php
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Minifyhtml Class
* Will Minify the HTML. Reducing network latency, enhancing compression, and faster browser loading and execution.
*
* @category Output
* @author John Gerome
* @link https://github.com/johngerome/CodeIgniter-Minifyhtml-hooks
*/
class Minifyhtml {
/**
* Responsible for sending final output to browser
*/
function output()
{
$CI =& get_instance();
$buffer = $CI->output->get_output();
$re = '% # Collapse ws everywhere but in blacklisted elements.
(?> # Match all whitespans other than single space.
[^\S ]\s* # Either one [\t\r\n\f\v] and zero or more ws,
| \s{2,} # or two or more consecutive-any-whitespace.
) # Note: The remaining regex consumes no text at all...
(?= # Ensure we are not in a blacklist tag.
(?: # Begin (unnecessary) group.
(?: # Zero or more of...
[^<]++ # Either one or more non-"<"
| < # or a < starting a non-blacklist tag.
(?!/?(?:textarea|pre)\b)
)*+ # (This could be "unroll-the-loop"ified.)
) # End (unnecessary) group.
(?: # Begin alternation group.
< # Either a blacklist start tag.
(?>textarea|pre)\b
| \z # or end of file.
) # End alternation group.
) # If we made it here, we are not in a blacklist tag.
%ix';
$buffer = preg_replace($re, " ", $buffer);
$CI->output->set_output($buffer);
$CI->output->_display();
}
}
?>
пожалуйста, помогите мне.