|
Line
Link Here
|
| 0 |
-- app/modules/AppKit/config/module.xml.in |
0 |
++ app/modules/AppKit/config/module.xml.in |
|
Lines 29-34
Link Here
|
| 29 |
<setting name="squishloader"> |
29 |
<setting name="squishloader"> |
| 30 |
<ae:parameter name="cache_dir">%core.cache_dir%/Squished</ae:parameter> |
30 |
<ae:parameter name="cache_dir">%core.cache_dir%/Squished</ae:parameter> |
| 31 |
<ae:parameter name="use_caching">@flag_caching@</ae:parameter> |
31 |
<ae:parameter name="use_caching">@flag_caching@</ae:parameter> |
|
|
32 |
<ae:parameter name="use_gzcompress">false</ae:parameter> |
| 33 |
<ae:parameter name="gzcompress_level">2</ae:parameter> |
| 32 |
</setting> |
34 |
</setting> |
| 33 |
|
35 |
|
| 34 |
<setting name="user_preferences_default"> |
36 |
<setting name="user_preferences_default"> |
| 35 |
-- app/modules/AppKit/validate/Widgets/SquishLoader.xml |
37 |
++ app/modules/AppKit/validate/Widgets/SquishLoader.xml |
|
Lines 5-16
Link Here
|
| 5 |
parent="%core.module_dir%/AppKit/config/validators.xml" |
5 |
parent="%core.module_dir%/AppKit/config/validators.xml" |
| 6 |
> |
6 |
> |
| 7 |
<ae:configuration> |
7 |
<ae:configuration> |
| 8 |
|
|
|
| 9 |
<validators> |
8 |
<validators> |
| 10 |
<validator class="string" name="IfNoneMatch" source="headers" required="false"> |
9 |
<validator class="string" name="IfNoneMatch" source="headers" required="false"> |
| 11 |
<argument>IF_NONE_MATCH</argument> |
10 |
<argument>IF_NONE_MATCH</argument> |
| 12 |
</validator> |
11 |
</validator> |
| 13 |
|
12 |
|
|
|
13 |
<validator class="string" name="accept_encoding" source="headers" required="true"> |
| 14 |
<argument>ACCEPT_ENCODING</argument> |
| 15 |
|
| 16 |
<errors> |
| 17 |
<error>Could not validate HTTP_REFERER</error> |
| 18 |
</errors> |
| 19 |
</validator> |
| 14 |
</validators> |
20 |
</validators> |
| 15 |
</ae:configuration> |
21 |
</ae:configuration> |
| 16 |
</ae:configurations> |
22 |
</ae:configurations> |
| 17 |
-- app/modules/AppKit/views/Widgets/SquishLoaderSuccessView.class.php |
23 |
++ app/modules/AppKit/views/Widgets/SquishLoaderSuccessView.class.php |
|
Lines 45-52
class AppKit_Widgets_SquishLoaderSuccessView extends AppKitBaseView {
Link Here
|
| 45 |
return ""; |
45 |
return ""; |
| 46 |
} |
46 |
} |
| 47 |
|
47 |
|
| 48 |
ob_start("ob_gzhandler"); |
48 |
$options = AgaviConfig::get('modules.appkit.squishloader', array()); |
| 49 |
|
49 |
$gz_level = isset($options['gzcompress_level']) ? |
|
|
50 |
(integer)$options['gzcompress_level'] : 3; |
| 51 |
$gz_use = isset($options['use_gzcompress']) ? |
| 52 |
(boolean)$options['use_gzcompress'] : false; |
| 53 |
|
| 54 |
if ($gz_use === true) { |
| 55 |
|
| 56 |
$encoding = $rd->getHeader('ACCEPT_ENCODING', false); |
| 57 |
|
| 58 |
if (strpos($encoding, 'gzip') !== false) { |
| 59 |
$encoding = 'gzip'; |
| 60 |
} elseif(strpos($encoding, 'x-gzip') !== false) { |
| 61 |
$encoding = 'x-gzip'; |
| 62 |
} |
| 63 |
|
| 64 |
if ($encoding !== false) { |
| 65 |
header('Content-Encoding: '. $encoding); |
| 66 |
$l = strlen($content); |
| 67 |
$content = gzcompress($content, 4); |
| 68 |
$content = substr($content, 0, $l); |
| 69 |
return "\x1f\x8b\x08\x00\x00\x00\x00\x00". $content; |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 50 |
return $content; |
73 |
return $content; |
| 51 |
} |
74 |
} |
| 52 |
} |
75 |
} |