HEX
Server: Apache/2.4.59 (Debian)
System: Linux skycube.cz 4.19.0-25-amd64 #1 SMP Debian 4.19.289-2 (2023-08-08) x86_64
User: ilya (534)
PHP: 7.3.31-1~deb10u7
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/ilya/data/www/irkboard.ru/public/min/lib/Minify/Controller/Page.php
<?php
/**
 * Class Minify_Controller_Page  
 * @package Minify
 */

require_once 'Minify/Controller/Base.php';

/**
 * Controller class for serving a single HTML page
 * 
 * @link http://code.google.com/p/minify/source/browse/trunk/web/examples/1/index.php#59
 * @package Minify
 * @author Stephen Clay <steve@mrclay.org>
 */
class Minify_Controller_Page extends Minify_Controller_Base {
    
    /**
     * Set up source of HTML content
     * 
     * @param array $options controller and Minify options
     * @return array Minify options
     * 
     * Controller options:
     * 
     * 'content': (required) HTML markup
     * 
     * 'id': (required) id of page (string for use in server-side caching)
     * 
     * 'lastModifiedTime': timestamp of when this content changed. This
     * is recommended to allow both server and client-side caching.
     * 
     * 'minifyAll': should all CSS and Javascript blocks be individually 
     * minified? (default false) 
     *
     * @todo Add 'file' option to read HTML file.
     */
    public function setupSources($options) {
        if (isset($options['file'])) {
            $sourceSpec = array(
                'filepath' => $options['file']
            );
        } else {
            // strip controller options
            $sourceSpec = array(
                'content' => $options['content']
                ,'id' => $options['id']
            );
            unset($options['content'], $options['id']);
        }
        if (isset($options['minifyAll'])) {
            // this will be the 2nd argument passed to Minify_HTML::minify()
            $sourceSpec['minifyOptions'] = array(
                'cssMinifier' => array('Minify_CSS', 'minify')
                ,'jsMinifier' => array('Minify_Javascript', 'minify')
            );
            $this->_loadCssJsMinifiers = true;
            unset($options['minifyAll']);
        }
        $this->sources[] = new Minify_Source($sourceSpec);
        
        // may not be needed
        //$options['minifier'] = array('Minify_HTML', 'minify');
        
        $options['contentType'] = Minify::TYPE_HTML;
        return $options;
    }
    
    protected $_loadCssJsMinifiers = false;
    
    /**
     * @see Minify_Controller_Base::loadMinifier()
     */
    public function loadMinifier($minifierCallback)
    {
        if ($this->_loadCssJsMinifiers) {
            // Minify will not call for these so we must manually load
            // them when Minify/HTML.php is called for.
            require 'Minify/CSS.php';
            require 'Minify/Javascript.php';
        }
        parent::loadMinifier($minifierCallback); // load Minify/HTML.php
    }
}