1 | <?php |
---|
2 | |
---|
3 | // ICI : Commenter l'une des deux lignes pour fixer l'éditeur par défaut |
---|
4 | define('EDITEUR_PAR_DEFAUT', 'wysiwyg'); |
---|
5 | //define('EDITEUR_PAR_DEFAUT', 'text'); |
---|
6 | |
---|
7 | // détermination du chemin de base par rapport à la racine du serveur |
---|
8 | $p=explode(basename(_DIR_PLUGINS)."/",str_replace('\\',/*'*/'/',realpath(dirname(__FILE__)))); |
---|
9 | define('_DIR_RELATIF_PLUGIN_FCKEDITOR',str_replace('../','',(_DIR_PLUGINS.end($p)))); |
---|
10 | |
---|
11 | $dir_relatif_array = explode('/', $_SERVER["PHP_SELF"]); |
---|
12 | $i = 0; |
---|
13 | while($dir_relatif_array[$i] != 'ecrire') |
---|
14 | { |
---|
15 | $dir_relatif .= $dir_relatif_array[$i]."/"; |
---|
16 | $i++; |
---|
17 | } |
---|
18 | //if($dir_relatif != '') $dir_relatif = "/".$dir_relatif; |
---|
19 | |
---|
20 | define('_DIR_PLUGIN_FCKEDITOR',$dir_relatif._DIR_RELATIF_PLUGIN_FCKEDITOR); |
---|
21 | |
---|
22 | |
---|
23 | function fckeditor2_header_prive($flux) |
---|
24 | { |
---|
25 | global $exec; |
---|
26 | |
---|
27 | $code=''; |
---|
28 | if($exec=='articles' || $exec=='breves_voir') |
---|
29 | { |
---|
30 | if(EDITEUR_PAR_DEFAUT=='text') |
---|
31 | { |
---|
32 | $code=' |
---|
33 | $("img[@src*=\'edit.gif\']").parent().each(function(i){ |
---|
34 | $(this).before(this.cloneNode(true)); |
---|
35 | $(this).attr("href", $(this).attr("href")+"&wysiwyg=oui"); |
---|
36 | $(this).find("span").html(\''.addslashes(_T('fckeditor:icone_modifier_article_fck')).'\'); |
---|
37 | });'; |
---|
38 | } |
---|
39 | else |
---|
40 | { |
---|
41 | $code=' |
---|
42 | $("img[@src*=\'edit.gif\']").parent().each(function(i){ |
---|
43 | $(this).before(this.cloneNode(true)); |
---|
44 | $(this).attr("href", $(this).attr("href")+"&wysiwyg=non"); |
---|
45 | $(this).find("span").html(\''.addslashes(_T('fckeditor:icone_modifier_article_spip')).'\'); |
---|
46 | });'; |
---|
47 | } |
---|
48 | |
---|
49 | } |
---|
50 | elseif($exec=='articles_edit' && ( $GLOBALS['wysiwyg']=='oui' |
---|
51 | || (EDITEUR_PAR_DEFAUT=='wysiwyg' && $GLOBALS['wysiwyg']!='non') ) ) |
---|
52 | { |
---|
53 | $code=' |
---|
54 | var oFCKeditor = new FCKeditor( "text_area" ) ; |
---|
55 | oFCKeditor.BasePath = "'._DIR_PLUGIN_FCKEDITOR.'/FCKeditor/" ; |
---|
56 | oFCKeditor.Config["CustomConfigurationsPath"] = "'._DIR_PLUGIN_FCKEDITOR.'/spip_fck/fckconfig.php?path='._DIR_PLUGIN_FCKEDITOR.'&" + ( new Date() * 1 ) ; |
---|
57 | oFCKeditor.Config[ "AutoDetectLanguage" ] = false ; |
---|
58 | oFCKeditor.Config[ "DefaultLanguage" ] = "'.$GLOBALS['_COOKIE']['spip_lang_ecrire'].'" ; |
---|
59 | oFCKeditor.Height = "600"; |
---|
60 | oFCKeditor.ToolbarSet = "BarreArticle"; |
---|
61 | oFCKeditor.ReplaceTextarea(); |
---|
62 | $(".spip_barre").remove(); |
---|
63 | '; |
---|
64 | } |
---|
65 | elseif($exec=='breves_edit' && ( $GLOBALS['wysiwyg']=='oui' |
---|
66 | || (EDITEUR_PAR_DEFAUT=='wysiwyg' && $GLOBALS['wysiwyg']!='non') ) ) |
---|
67 | { |
---|
68 | $code=' |
---|
69 | var oFCKeditor = new FCKeditor( \'texte\' ) ; |
---|
70 | oFCKeditor.BasePath = "'._DIR_PLUGIN_FCKEDITOR.'/FCKeditor/" ; |
---|
71 | oFCKeditor.Config["CustomConfigurationsPath"] = "'._DIR_PLUGIN_FCKEDITOR.'/spip_fck/fckconfig.php?path='._DIR_PLUGIN_FCKEDITOR.'&" + ( new Date() * 1 ) ; |
---|
72 | oFCKeditor.Config[ "AutoDetectLanguage" ] = false ; |
---|
73 | oFCKeditor.Config[ "DefaultLanguage" ] = "'.$GLOBALS['_COOKIE']['spip_lang_ecrire'].'" ; |
---|
74 | oFCKeditor.Height = "600"; |
---|
75 | oFCKeditor.ToolbarSet = "BarreBreve"; |
---|
76 | oFCKeditor.ReplaceTextarea(); |
---|
77 | $(".spip_barre").remove(); |
---|
78 | '; |
---|
79 | } |
---|
80 | if(!empty($code)) |
---|
81 | { |
---|
82 | $code=' |
---|
83 | <script src="http://www.jquery.info/scripts/jquery-1.0.js" type="text/javascript"></script> |
---|
84 | <script type="text/javascript" src="'._DIR_PLUGIN_FCKEDITOR.'/FCKeditor/fckeditor.js"></script> |
---|
85 | <script type="text/javascript"> |
---|
86 | <!-- |
---|
87 | $(document).ready(function () { |
---|
88 | '.$code.' |
---|
89 | }); |
---|
90 | //--> |
---|
91 | </script>'; |
---|
92 | return $flux.$code; |
---|
93 | } |
---|
94 | |
---|
95 | return $flux; |
---|
96 | } |
---|
97 | |
---|
98 | // $texte = html_entity_decode(entites_html($row['texte'])); |
---|
99 | |
---|
100 | ?> |
---|