| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
global $CFG, $USER; |
|---|
| 8 |
$page_owner; |
|---|
| 9 |
|
|---|
| 10 |
run('userdetails:editor', $USER->ident) == "yes") { |
|---|
| 11 |
|
|---|
| 12 |
$USER->locale) || $USER->locale == 'default') { |
|---|
| 13 |
|
|---|
| 14 |
if (substr($CFG->defaultlocale, 2, 1) == "_") |
|---|
| 15 |
|
|---|
| 16 |
$lang = substr($CFG->defaultlocale, 0, 2); |
|---|
| 17 |
|
|---|
| 18 |
$lang = $CFG->defaultlocale; |
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
if (substr($USER->locale, 2, 1) == "_") |
|---|
| 23 |
|
|---|
| 24 |
$lang = substr($USER->locale, 0, 2); |
|---|
| 25 |
|
|---|
| 26 |
$lang = $USER->locale; |
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
$url = substr($CFG->wwwroot, 0, -1); |
|---|
| 32 |
|
|---|
| 33 |
$metatags; |
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
$plugins = 'spellchecker,emotions,contextmenu,preview,style,searchreplace,safari'; |
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
if (!empty($parameter) && is_array($parameter) && !empty($parameter[0]) && is_array($parameter[0])) { |
|---|
| 43 |
$elements = $parameter[0]; |
|---|
| 44 |
|
|---|
| 45 |
$elements = array("new_weblog_post","new_weblog_comment"); |
|---|
| 46 |
|
|---|
| 47 |
$elementstring = implode(",", $elements); |
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
$available_langs = array('English=en','Dutch=nl','German=de', |
|---|
| 51 |
'Spanish=es','Danish=dk','Swedish=sv', |
|---|
| 52 |
'French=fr','Japanese=jp'); |
|---|
| 53 |
$spell_langs = array(); |
|---|
| 54 |
$spell_found = false; |
|---|
| 55 |
|
|---|
| 56 |
$available_langs as $slang) { |
|---|
| 57 |
$lang_code = substr($slang,strlen($slang)-2,2); |
|---|
| 58 |
|
|---|
| 59 |
$lang_code == $lang) { |
|---|
| 60 |
$spell_langs[] = '+' . $slang; |
|---|
| 61 |
$spell_found = true; |
|---|
| 62 |
|
|---|
| 63 |
$spell_langs[] = $slang; |
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
$spellcheck_languages = implode(',', $spell_langs); |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
if (!$spell_found) { |
|---|
| 71 |
$spellcheck_languages = '+' . $spellcheck_languages; |
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
$metatags .= <<< END |
|---|
| 75 |
<script language="javascript" type="text/javascript" src="$url/mod/tinymce/lib/jscripts/tiny_mce/tiny_mce_gzip.js"></script> |
|---|
| 76 |
|
|---|
| 77 |
<script language="javascript" type="text/javascript"> |
|---|
| 78 |
tinyMCE_GZ.init({ |
|---|
| 79 |
plugins : '$plugins', |
|---|
| 80 |
themes : 'advanced', |
|---|
| 81 |
language : '$lang', |
|---|
| 82 |
disk_cache : true, |
|---|
| 83 |
debug : false |
|---|
| 84 |
}); |
|---|
| 85 |
</script> |
|---|
| 86 |
|
|---|
| 87 |
<script language="javascript" type="text/javascript"> |
|---|
| 88 |
tinyMCE.init({ |
|---|
| 89 |
language : "$lang", |
|---|
| 90 |
mode : "exact", |
|---|
| 91 |
plugins : "$plugins", |
|---|
| 92 |
convert_urls : false, |
|---|
| 93 |
relative_urls : false, |
|---|
| 94 |
elements : "$elementstring", |
|---|
| 95 |
theme : "advanced", |
|---|
| 96 |
theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,image,undo,redo,link,unlink,code,spellchecker,emotions", |
|---|
| 97 |
theme_advanced_buttons2 : "preview,styleprops,search,replace", |
|---|
| 98 |
theme_advanced_buttons3 : "", |
|---|
| 99 |
theme_advanced_toolbar_location : "top", |
|---|
| 100 |
theme_advanced_toolbar_align : "left", |
|---|
| 101 |
theme_advanced_path_location : "bottom", |
|---|
| 102 |
plugin_preview_width : "500", |
|---|
| 103 |
plugin_preview_height : "600", |
|---|
| 104 |
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]", |
|---|
| 105 |
remove_linebreaks: true, |
|---|
| 106 |
theme_advanced_source_editor_width : "400", |
|---|
| 107 |
theme_advanced_source_editor_height : "400", |
|---|
| 108 |
spellchecker_languages : "$spellcheck_languages", |
|---|
| 109 |
document_base_url : "$url", |
|---|
| 110 |
fullscreen_settings : { |
|---|
| 111 |
theme_advanced_path_location : "top" |
|---|
| 112 |
} |
|---|
| 113 |
}); |
|---|
| 114 |
</script>\n |
|---|
| 115 |
END; |
|---|
| 116 |
} |
|---|
| 117 |
?> |
|---|
| 118 |
|
|---|