[ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system - Tiny MCE controller file. 5 | 6 | $Source: /cvsroot/e107/e107_0.7/e107_handlers/tiny_mce/wysiwyg.php,v $ 7 | $Revision: 1.32 $ 8 | $Date: 2006/11/23 17:36:29 $ 9 | $Author: mcfly_e107 $ 10 +----------------------------------------------------------------------------+ 11 */ 12 13 function wysiwyg($formids){ 14 define("ADMIN",""); 15 global $pref,$HANDLERS_DIRECTORY,$PLUGINS_DIRECTORY,$IMAGES_DIRECTORY; 16 $lang = e_LANGUAGE; 17 $tinylang = array( 18 "Arabic" => "ar", 19 "Danish" => "da", 20 "Dutch" => "nl", 21 "English" => "en", 22 "Farsi" => "fa", 23 "French" => "fr", 24 "German" => "de", 25 "Greek" => "el", 26 "Hebrew" => " ", 27 "Hungarian" => "hu", 28 "Italian" => "it", 29 "Japanese" => "ja", 30 "Korean" => "ko", 31 "Norwegian" => "nb", 32 "Polish" => "pl", 33 "Russian" => "ru", 34 "Slovak" => "sk", 35 "Spanish" => "es", 36 "Swedish" => "sv" 37 ); 38 39 if(!$tinylang[$lang]){ 40 $tinylang[$lang] = "en"; 41 } 42 43 $thescript = (strpos($_SERVER['SERVER_SOFTWARE'],"mod_gzip")) ? "tiny_mce_gzip.php" : "tiny_mce.js"; 44 45 $text = "<script type='text/javascript' src='".e_HANDLER."tiny_mce/".$thescript."'></script>\n"; 46 47 $text .= "<script type='text/javascript'>\n tinyMCE.init({\n"; 48 49 $text .= "language : '".$tinylang[$lang]."',\n"; 50 $text .= "mode : 'exact',\n"; 51 $text .= "elements : '".$formids."',\n"; 52 $text .= "theme : 'advanced'\n"; 53 $text .= ",plugins : 'table,contextmenu"; 54 55 $text .= ($pref['smiley_activate']) ? ",emoticons" : ""; 56 $text .= (ADMIN) ? ",ibrowser" : ",image"; 57 $text .= ",iespell,zoom,media,forecolor"; 58 $text .= "'\n"; // end of plugins list. 59 60 $text .= ",theme_advanced_buttons1 : 'fontsizeselect,separator,bold,italic,underline,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent, indent,separator, forecolor,cut,copy,paste'"; 61 62 $text .= ",theme_advanced_buttons2 : 'tablecontrols,separator,undo,redo,separator,link,unlink"; 63 $text .= ($pref['smiley_activate']) ? ",emoticons" : ""; 64 $text .= ",charmap,iespell,media"; 65 $text .= (ADMIN) ? ",ibrowser," : ",image"; 66 $text .= (ADMIN) ? ",code" : ""; 67 $text .= "'"; // end of buttons 2 68 69 $text .= ",theme_advanced_buttons3 : ''"; 70 $text .= ",theme_advanced_toolbar_location : 'top'"; 71 $text .= ",extended_valid_elements : 'p[style],a[name|href|target|rel|title|style|class],img[class|src|style|alt|title|name],hr[class],span[align|class|style],div[align|class|style|height|width] ,table[class|style|cellpadding|cellspacing|background|height|width],td[background|style|class|valign|align|height|width]'"; 72 $text .= ",invalid_elements: 'p,font,align,script,applet,iframe'\n"; 73 $text .= ",auto_cleanup_word: true\n"; 74 $text .= ",convert_fonts_to_spans : true\n"; 75 $text .= ",trim_span_elements: true\n"; 76 $text .= ",inline_styles: true\n"; 77 $text .= ",debug: false\n"; 78 $text .= ",force_br_newlines: true\n"; 79 $text .= ",force_p_newlines: false\n"; 80 $text .= ",entity_encoding: \"raw\" \n"; 81 $text .= ",convert_fonts_to_styles: true\n"; 82 $text .= ",remove_script_host : true\n"; 83 $text .= ",relative_urls: true\n"; 84 $text .= ",document_base_url: '".SITEURL."'\n"; 85 $text .= ",theme_advanced_styles: 'border=border;fborder=fborder;tbox=tbox;caption=caption;fcaption=fcaption;forumheader=forumheader;forumheader3=forumheader3'\n"; 86 $text .= ",popup_css: '".THEME."style.css'\n"; 87 $text .= ",verify_css_classes : false\n"; 88 $text .= ",cleanup_callback : \"tinymce_html_bbcode_control\" \n"; 89 $text .= (ADMIN) ? "\n, external_link_list_url: '../".$HANDLERS_DIRECTORY."tiny_mce/filelist.php'\n" : ""; 90 91 $text .= " 92 93 }); 94 95 function tinymce_html_bbcode_control(type, source) { 96 97 switch (type) { 98 99 case 'get_from_editor': 100 // Convert HTML to e107-BBcode 101 source = source.replace(/target=\"_blank\"/, 'rel=\"external\"'); 102 source = source.replace(/^\s*|\s*$/g,''); 103 if(source != '') 104 { 105 source = '[html]\\n' + source + '\\n[/html]'; 106 /* 107 source = source.replace(/<\/strong>/gi,'[/b]'); 108 source = source.replace(/<strong>/gi,'[b]'); 109 source = source.replace(/<\/em>/gi,'[/i]'); 110 source = source.replace(/<em>/gi,'[i]'); 111 source = source.replace(/<\/u>/gi,'[/u]'); 112 source = source.replace(/<u>/gi,'[u]'); 113 source = source.replace(/<\/strong>/gi,'[/b]'); 114 source = source.replace(/<img/gi,'[img'); 115 source = source.replace(/<\/strong>/gi,'[/b]'); 116 source = source.replace(/<a href=\"(.*?)\"(.*?)>(.*?)<\/a>/gi,'[link=$1 $2]$3[/link]'); 117 */ 118 119 } 120 121 // Convert e107 paths. 122 source = source.replace(/\"".str_replace("/","\/",$IMAGES_DIRECTORY)."/g,'\"{e_IMAGE}'); 123 source = source.replace(/\"".str_replace("/","\/",$PLUGINS_DIRECTORY)."/g,'\"{e_PLUGIN}'); 124 source = source.replace(/\'".str_replace("/","\/",$IMAGES_DIRECTORY)."/g,'\'{e_IMAGE}'); 125 source = source.replace(/\'".str_replace("/","\/",$PLUGINS_DIRECTORY)."/g,'\'{e_PLUGIN}'); 126 127 break; 128 129 case 'insert_to_editor': 130 // Convert e107-BBcode to HTML 131 source = source.replace(/rel=\"external\"/, 'target=\"_blank\"'); 132 133 html_bbcode_check = source.slice(0,6); 134 135 if (html_bbcode_check == '[html]') { 136 source = source.slice(6); 137 } 138 139 html_bbcode_check = source.slice(-7); 140 141 if (html_bbcode_check == '[/html]') { 142 source = source.slice(0, -7); 143 } 144 /* 145 source = source.replace(/\[b\]/gi,'<strong>'); 146 source = source.replace(/\[\/b\]/gi,'<\/strong>'); 147 */ 148 source = source.replace(/\{e_IMAGE\}/gi,'".$IMAGES_DIRECTORY."'); 149 source = source.replace(/\{e_PLUGIN\}/gi,'".$PLUGINS_DIRECTORY."'); 150 151 break; 152 } 153 154 return source; 155 } 156 157 158 </script>\n 159 "; 160 161 return $text; 162 163 } 164 165 166 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |