1 | <?php |
---|
2 | |
---|
3 | // détermination du chemin de base par rapport à la racine du serveur |
---|
4 | // $dir_relatif_array = split('/', $_SERVER["PHP_SELF"]); |
---|
5 | // $i = 0; |
---|
6 | // while($dir_relatif_array[$i] != 'ecrire') { |
---|
7 | // $dir_relatif .= $dir_relatif_array[$i]; |
---|
8 | // $i++; |
---|
9 | // } |
---|
10 | // if($dir_relatif != '') $dir_relatif = "/".$dir_relatif; |
---|
11 | // define('_DIR_PLUGIN_ABS_FCKEDITOR',$dir_relatif.'/plugins/fckeditor'); |
---|
12 | // détermination du chemin de base par rapport à la racine du serveur |
---|
13 | $p=explode(basename(_DIR_PLUGINS)."/",str_replace('\\',/*'*/'/',realpath(dirname(__FILE__)))); |
---|
14 | define('_DIR_RELATIF_PLUGIN_FCKEDITOR',str_replace('../','',(_DIR_PLUGINS.end($p)))); |
---|
15 | |
---|
16 | $dir_relatif_array = split('/', $_SERVER["PHP_SELF"]); |
---|
17 | $i = 0; |
---|
18 | while($dir_relatif_array[$i] != 'ecrire') |
---|
19 | { |
---|
20 | $dir_relatif .= $dir_relatif_array[$i]."/"; |
---|
21 | $i++; |
---|
22 | } |
---|
23 | |
---|
24 | define('_DIR_PLUGIN_ABS_FCKEDITOR',$dir_relatif._DIR_RELATIF_PLUGIN_FCKEDITOR); |
---|
25 | |
---|
26 | function fckeditor_header_prive($flux) { |
---|
27 | global $exec; |
---|
28 | |
---|
29 | $code=''; |
---|
30 | |
---|
31 | $langue = ($GLOBALS['_COOKIE']['spip_lang_ecrire'] != '') ? $GLOBALS['_COOKIE']['spip_lang_ecrire'] : 'fr'; |
---|
32 | |
---|
33 | if($exec=='articles_edit') { |
---|
34 | |
---|
35 | $code=' |
---|
36 | |
---|
37 | $("textarea[@name=texte]").after("<div id=\"fckeditor_div\"><input id=\"_BtnSwitchTextarea\" type=\"button\" value=\"'._T("fckeditor:texte_editeur_standard").'\" onclick=\"Toggle()\" /><textarea id=\"fckeditor_data\" cols=\"40\" rows=\"20\">"+$("textarea[@name=texte]").val()+"</textarea></div>"); |
---|
38 | $(".spip_barre").before("<input type=\"button\" value=\"'._T("fckeditor:texte_editeur_avance").'\" id=\"fckeditor_switch\" onclick=\"Toggle()\" />"); |
---|
39 | $("textarea[@name=texte]").css("display", "none"); |
---|
40 | $("#fckeditor_switch").css("display", "none"); |
---|
41 | $(document.forms["formulaire"]).bind("submit", PrepareSave); |
---|
42 | $(".spip_barre").css("display", "none"); |
---|
43 | |
---|
44 | var oFCKeditor = new FCKeditor( "fckeditor_data" , "100%", "600", "Spip") ; |
---|
45 | oFCKeditor.BasePath = "'._DIR_PLUGIN_FCKEDITOR.'/fckeditor/" ; |
---|
46 | oFCKeditor.Config["CustomConfigurationsPath"] = "'._DIR_PLUGIN_ABS_FCKEDITOR.'/spip_fck/fckconfig.php?path='._DIR_PLUGIN_ABS_FCKEDITOR.'&" + ( new Date() * 1 ) ; |
---|
47 | oFCKeditor.Config[ "AutoDetectLanguage" ] = false ; |
---|
48 | oFCKeditor.Config[ "DefaultLanguage" ] = "'.$langue.'" ; |
---|
49 | oFCKeditor.ToolbarSet = "BarreArticle"; |
---|
50 | oFCKeditor.ReplaceTextarea(); |
---|
51 | '; |
---|
52 | } |
---|
53 | if($exec=='breves_edit') { |
---|
54 | |
---|
55 | $code=' |
---|
56 | |
---|
57 | $("textarea[@name=texte]").after("<div id=\"fckeditor_div\"><input id=\"_BtnSwitchTextarea\" type=\"button\" value=\"'._T("fckeditor:texte_editeur_standard").'\" onclick=\"Toggle()\" /><textarea id=\"fckeditor_data\" cols=\"40\" rows=\"20\">"+$("textarea[@name=texte]").val()+"</textarea></div>"); |
---|
58 | $(".spip_barre").before("<input type=\"button\" value=\"'._T("fckeditor:texte_editeur_avance").'\" id=\"fckeditor_switch\" onclick=\"Toggle()\" />"); |
---|
59 | $("textarea[@name=texte]").css("display", "none"); |
---|
60 | $("#fckeditor_switch").css("display", "none"); |
---|
61 | $(document.forms["formulaire"]).bind("submit", PrepareSave); |
---|
62 | $(".spip_barre").css("display", "none"); |
---|
63 | |
---|
64 | var oFCKeditor = new FCKeditor(\'fckeditor_data\' , "100%", "300", "Spip") ; |
---|
65 | oFCKeditor.BasePath = "'._DIR_PLUGIN_FCKEDITOR.'/fckeditor/" ; |
---|
66 | oFCKeditor.Config["CustomConfigurationsPath"] = "'._DIR_PLUGIN_ABS_FCKEDITOR.'/spip_fck/fckconfig.php?path='._DIR_PLUGIN_ABS_FCKEDITOR.'&" + ( new Date() * 1 ) ; |
---|
67 | oFCKeditor.Config[ "AutoDetectLanguage" ] = false ; |
---|
68 | oFCKeditor.Config[ "DefaultLanguage" ] = "'.$langue.'" ; |
---|
69 | oFCKeditor.ToolbarSet = "BarreBreve"; |
---|
70 | oFCKeditor.ReplaceTextarea(); |
---|
71 | '; |
---|
72 | } |
---|
73 | if($exec=='rubriques_edit') { |
---|
74 | |
---|
75 | $code=' |
---|
76 | |
---|
77 | $("textarea[@name=texte]").after("<div id=\"fckeditor_div\"><input id=\"_BtnSwitchTextarea\" type=\"button\" value=\"'._T("fckeditor:texte_editeur_standard").'\" onclick=\"Toggle()\" /><textarea id=\"fckeditor_data\" cols=\"40\" rows=\"20\">"+$("#texte").val()+"</textarea></div>"); |
---|
78 | $(".spip_barre").before("<input type=\"button\" value=\"'._T("fckeditor:texte_editeur_avance").'\" id=\"fckeditor_switch\" onclick=\"Toggle()\" />"); |
---|
79 | $("textarea[@name=texte]").css("display", "none"); |
---|
80 | $("#fckeditor_switch").css("display", "none"); |
---|
81 | $(document.forms["formulaire"]).bind("submit", PrepareSave); |
---|
82 | $(".spip_barre").css("display", "none"); |
---|
83 | |
---|
84 | var oFCKeditor = new FCKeditor(\'fckeditor_data\' , "100%", "300", "Spip") ; |
---|
85 | oFCKeditor.BasePath = "'._DIR_PLUGIN_FCKEDITOR.'/fckeditor/" ; |
---|
86 | oFCKeditor.Config["CustomConfigurationsPath"] = "'._DIR_PLUGIN_ABS_FCKEDITOR.'/spip_fck/fckconfig.php?path='._DIR_PLUGIN_ABS_FCKEDITOR.'&" + ( new Date() * 1 ) ; |
---|
87 | oFCKeditor.Config[ "AutoDetectLanguage" ] = false ; |
---|
88 | oFCKeditor.Config[ "DefaultLanguage" ] = "'.$langue.'" ; |
---|
89 | oFCKeditor.ToolbarSet = "BarreRubrique"; |
---|
90 | oFCKeditor.ReplaceTextarea(); |
---|
91 | '; |
---|
92 | } |
---|
93 | |
---|
94 | |
---|
95 | if(!empty($code)) { |
---|
96 | $code=' |
---|
97 | <script type="text/javascript" src="'._DIR_PLUGIN_FCKEDITOR.'fckeditor/fckeditor.js"></script> |
---|
98 | <script type="text/javascript" src="'._DIR_PLUGIN_FCKEDITOR.'spip_fck/switch.js"></script> |
---|
99 | <script type="text/javascript"><!-- |
---|
100 | $(document).ready(function () { |
---|
101 | '.$code.' |
---|
102 | }); |
---|
103 | //--> |
---|
104 | |
---|
105 | </script>'; |
---|
106 | return $flux.$code; |
---|
107 | } |
---|
108 | |
---|
109 | return $flux; |
---|
110 | } |
---|
111 | |
---|
112 | ?> |
---|