Definition at line 49 of file optimize_manager.inc.
◆ clearCache()
static OptimizeManager::clearCache |
( |
| ) |
|
|
static |
Definition at line 66 of file optimize_manager.inc.
68 Cache::invalidate(
"script_cache");
69 Cache::invalidate(
"script_cache_timestamp");
70 Cache::invalidate(
"css_cache");
71 Cache::invalidate(
"css_cache_timestamp");
72 Settings::setDefaultValue(
"optimize",
"optimize_scripts",
"", Boolean,
"Combine site Javascript into a single file",
"Javascript",
null, 1);
73 Settings::setDefaultValue(
"optimize",
"optimize_styles",
"", Boolean,
"Combine site CSS into a single file",
"CSS",
null, 1);
75 Settings::setDefaultValue(
"optimize",
"compress_javascript",
"", Boolean,
"Enable zip compression when serving Javascript",
"Javascript",
null, 2);
76 Settings::setDefaultValue(
"optimize",
"compress_styles",
"", Boolean,
"Enable zip compression when serving CSS",
"CSS",
null, 2);
78 Settings::setDefaultValue(
"optimize",
"compress_page_content",
"", Boolean,
"Enable zip compression when serving page content",
"Page Content",
null, 1);
79 Settings::setDefaultValue(
"optimize",
"append_timestamp",
false, Boolean,
"Specifies whether to include a timestamp in the generated link for optimized scripts and styles",
"Page Content",
null, 2);
static setDefaultValue($component, $name, $value, $field_type="String", $annotation="", $category="", $options="", $weight=0)
Sets the default value of the given component setting.
◆ flushZip()
static OptimizeManager::flushZip |
( |
| ) |
|
|
static |
◆ getScriptsContent()
static OptimizeManager::getScriptsContent |
( |
| ) |
|
|
static |
Definition at line 133 of file optimize_manager.inc.
135 $content = Cache::get(
"script_cache");
140 $content = Cache::get(
"script_cache");
static loadScripts()
Load the list of JS scripts from the manifests of all registered, active components.
static preprocessScripts($scripts)
if(array_key_exists("HTTP_IF_MODIFIED_SINCE", $_SERVER)) $content
◆ getStylesContent()
static OptimizeManager::getStylesContent |
( |
| ) |
|
|
static |
Definition at line 196 of file optimize_manager.inc.
198 $cachedStyles = Cache::get(
"css_cache");
204 $cachedStyles = Cache::get(
"css_cache");
207 return $cachedStyles;
static loadStyles()
Load the list of CSS files from the manifests of all registered, active components.
static preProcessStyles($styles)
◆ onInitialize()
static OptimizeManager::onInitialize |
( |
| ) |
|
|
static |
Definition at line 60 of file optimize_manager.inc.
62 global $css_cache_timestamp;
63 $css_cache_timestamp = Cache::get(
"css_cache_timestamp");
◆ postAction()
static OptimizeManager::postAction |
( |
|
$action | ) |
|
|
static |
◆ preAction()
static OptimizeManager::preAction |
( |
|
$action | ) |
|
|
static |
Definition at line 222 of file optimize_manager.inc.
224 trace(
"PreAction: $action", 3);
228 if (
Settings::getValue(
"optimize",
"compress_javascript") && substr_count($_SERVER[
'HTTP_ACCEPT_ENCODING'],
'gzip'))
230 trace(
"Compressing scripts", 3);
237 if (
Settings::getValue(
"optimize",
"compress_styles") && substr_count($_SERVER[
'HTTP_ACCEPT_ENCODING'],
'gzip'))
239 trace(
"Compressing styles", 3);
static getValue($component, $name)
Retrieve the value of the specified Setting.
◆ preProcessPage()
static OptimizeManager::preProcessPage |
( |
|
$template | ) |
|
|
static |
Definition at line 210 of file optimize_manager.inc.
212 if (
Settings::getValue(
"optimize",
"compress_page_content") && substr_count($_SERVER[
'HTTP_ACCEPT_ENCODING'],
'gzip'))
214 ob_start(
"ob_gzhandler");
215 $level = ob_get_level();
216 trace(
"ZIP output buffer level: $level", 3);
static $outputBufferLevel
Records the level at which gzip output buffering began.
◆ preprocessScripts()
static OptimizeManager::preprocessScripts |
( |
|
$scripts | ) |
|
|
static |
Definition at line 82 of file optimize_manager.inc.
91 $cachedScripts = Cache::get(
"script_cache");
100 $file_modified = filemtime($resource);
106 $cachedScripts .= file_get_contents($resource);
107 $cachedScripts .=
"\r\n";
108 trace(
"Added $script", 3);
112 trace(
"Could not resolve script $script", 2);
121 Cache::put(
"script_cache", $cachedScripts);
125 $scriptLink =
Settings::getValue(
"optimize",
"append_timestamp") ?
"/action/optimize/scripts?".Cache::get(
"script_cache_timestamp") :
"/action/optimize/scripts";
127 $scripts = array($scriptLink);
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.
static resolveResource($resource, $component="")
Resolves the path to a web resource based on the PHP include path.
while(ob_get_level()) $last_modified
◆ preProcessStyles()
static OptimizeManager::preProcessStyles |
( |
|
$styles | ) |
|
|
static |
Definition at line 146 of file optimize_manager.inc.
155 $cachedStyles = Cache::get(
"css_cache");
164 $file_modified = filemtime($resource);
170 $cachedStyles .= file_get_contents($resource);
171 $cachedStyles .=
"\r\n";
175 $cachedStyles = preg_replace(
"/^@CHARSET.*$/mi",
"", $cachedStyles);
176 $cachedStyles = str_replace(
"\r\n",
"\n", $cachedStyles);
177 $cachedStyles = str_replace(
"\n",
"\r\n", $cachedStyles);
184 Cache::put(
"css_cache", $cachedStyles);
188 $styleLink =
Settings::getValue(
"optimize",
"append_timestamp") ?
"/action/optimize/styles?".Cache::get(
"css_cache_timestamp") :
"/action/optimize/styles";
◆ registerMinifier()
OptimizeManager::registerMinifier |
( |
|
$minifier | ) |
|
◆ startZip()
static OptimizeManager::startZip |
( |
| ) |
|
|
static |
Definition at line 248 of file optimize_manager.inc.
252 if (extension_loaded(
"zlib") && (ini_get(
"output_handler") !=
"ob_gzhandler"))
254 trace(
"Setting zlib.output_compression to On", 3);
257 @ini_set(
"zlib.output_compression",
'On');
258 @ini_set(
"zlib.output_compression_level", 9);
268 trace(
"zlib.output_compression = ".ini_get(
"zlib.output_compression"), 3);
◆ $minifier
OptimizeManager::$minifier = null |
|
static |
◆ $zipped
OptimizeManager::$zipped = false |
|
static |
The documentation for this class was generated from the following file: