PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.3
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.3
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / mrclay / minify / lib / Minify / Controller / Page.php

Page.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.2.3, at vendor/mrclay/minify/lib/Minify/Controller/Page.php

69 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class Minify_Controller_Page
4 * @package Minify
5 */
6
7 /**
8 * Controller class for serving a single HTML page
9 *
10 * @link http://code.google.com/p/minify/source/browse/trunk/web/examples/1/index.php#59
11 * @package Minify
12 * @author Stephen Clay <[email protected]>
13 */
14 class Minify_Controller_Page extends Minify_Controller_Base
15 {
16
17 /**
18 * Set up source of HTML content
19 *
20 * @param array $options controller and Minify options
21 * @return array Minify options
22 *
23 * Controller options:
24 *
25 * 'content': (required) HTML markup
26 *
27 * 'id': (required) id of page (string for use in server-side caching)
28 *
29 * 'lastModifiedTime': timestamp of when this content changed. This
30 * is recommended to allow both server and client-side caching.
31 *
32 * 'minifyAll': should all CSS and Javascript blocks be individually
33 * minified? (default false)
34 */
35 public function createConfiguration(array $options)
36 {
37 if (isset($options['file'])) {
38 $sourceSpec = array(
39 'filepath' => $options['file']
40 );
41 $f = $options['file'];
42 } else {
43 // strip controller options
44 $sourceSpec = array(
45 'content' => $options['content'],
46 'id' => $options['id'],
47 );
48 $f = $options['id'];
49 unset($options['content'], $options['id']);
50 }
51 // something like "builder,index.php" or "directory,file.html"
52 $selectionId = strtr(substr($f, 1 + strlen(dirname(dirname($f)))), '/\\', ',,');
53
54 if (isset($options['minifyAll'])) {
55 // this will be the 2nd argument passed to Minify_HTML::minify()
56 $sourceSpec['minifyOptions'] = array(
57 'cssMinifier' => array('Minify_CSSmin', 'minify'),
58 'jsMinifier' => array('JSMin\\JSMin', 'minify'),
59 );
60 unset($options['minifyAll']);
61 }
62
63 $sourceSpec['contentType'] = Minify::TYPE_HTML;
64 $sources[] = new Minify_Source($sourceSpec);
65
66 return new Minify_ServeConfiguration($options, $sources, $selectionId);
67 }
68 }
69