Skip to content

Commit

Permalink
MDL-15893: Adding caching to the TinyMCE config file
Browse files Browse the repository at this point in the history
  • Loading branch information
scyrma committed Aug 1, 2008
1 parent 66d68c0 commit e57fc04
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lib/editor/tinymce.js.php
Expand Up @@ -8,7 +8,6 @@
$editorlanguage = optional_param('editorlanguage', 'en_utf8', PARAM_ALPHANUMEXT);

$SESSION->lang = $editorlanguage;
//$editorlanguage = substr($editorlanguage, 0, strrpos($editorlanguage, '_'));;
$directionality = get_string('thisdirection');

/*
Expand Down Expand Up @@ -139,7 +138,7 @@
$strtime = get_string('strftimetime');
$strdate = get_string('strftimedaydate');

echo <<<EOF
$output = <<<EOF
tinyMCE.init({
mode: "textareas",
relative_urls: false,
Expand Down Expand Up @@ -190,8 +189,8 @@
EOF;
// the xhtml ruleset must be the last one - no comma at the end of the file
readfile('tinymce/xhtml_ruleset.txt');
echo <<<EOF
$output .= file_get_contents('tinymce/xhtml_ruleset.txt');
$output .= <<<EOF
});
function mce_toggleEditor(id) {
Expand All @@ -209,4 +208,15 @@ function mce_saveOnSubmit(id) {
};
}
EOF;

$lifetime = '86400';
@header('Content-type: text/javascript; charset=utf-8');
@header('Content-length: '.strlen($output));
@header('Last-Modified: '. gmdate('D, d M Y H:i:s', time()) .' GMT');
@header('Cache-control: max-age='.$lifetime);
@header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .'GMT');
@header('Pragma: ');

echo $output;

?>

0 comments on commit e57fc04

Please sign in to comment.