WordPress.org

Plugin Directory

Ticket #846: tinyMCEComments.patch

File tinyMCEComments.patch, 19.3 KB (added by ioannis.e, 10 years ago)
  • tinyMCEComments.php

     
    1 <?php 
    2 /* 
    3 Plugin Name: TinyMCEComments 
    4 Plugin URI: http://mk.netgenes.org/my-plugins/mcecomments/ 
    5 Description: A simple hack to enable WYSIWYG editor TinyMCE on the comment field. 
    6 Version: 0.4.3-2 
    7 Author: Thomas Au(MK) 
    8 Author URI: http://mk.netgenes.org 
    9 */ 
    10  
    11 if ( !function_exists('wp_nonce_field') ) { 
    12         function mceComment_nonce_field($action = -1) { return; } 
    13         $mceComment_nonce = -1; 
    14 } else { 
    15         function mceComment_nonce_field($action = -1) { return wp_nonce_field($action); } 
    16         $mceComment_nonce = 'mceComment-update-key'; 
    17 } 
    18  
    19 function mce_addAdminPages() { 
    20         add_options_page('TinyMCEComments Options', 'TinyMCEComments', 8, 'tinyMCEComments', 'mceComment_optionPage'); 
    21 } 
    22  
    23 //Get available plugins of TinyMCE 
    24 function getMCEPlugins() { 
    25     if ($h = opendir(ABSPATH . 'wp-includes/js/tinymce/plugins')) { 
    26         while (($file = readdir($h)) !== false) { 
    27             if (is_file(ABSPATH . 'wp-includes/js/tinymce/plugins/' . $file . '/editor_plugin.js'))  
    28                 $plugins[] = $file; 
    29         } 
    30         closedir($h); 
    31     } 
    32  
    33     return $plugins; 
    34 } 
    35  
    36 //Get Available Languages in the directory 
    37 function getMCELangs() { 
    38     if ($h = opendir(ABSPATH . 'wp-includes/js/tinymce/langs/')) { 
    39         while (($file = readdir($h)) !== false) { 
    40             if (is_file(ABSPATH . 'wp-includes/js/tinymce/langs/' . $file) && strpos($file, '.js') !== false)  
    41                 $langs[] = basename($file, '.js'); 
    42         } 
    43         closedir($h); 
    44     } 
    45  
    46     return $langs; 
    47 } 
    48  
    49 function mceComment_optionPage() { 
    50         global $mceComment_nonce; 
    51  
    52         if ( isset($_POST['submit']) ) { 
    53                 if ( function_exists('current_user_can') && !current_user_can('manage_options') ) 
    54                         die(__('Cheatin&#8217; uh?')); 
    55  
    56                 check_admin_referer($mceComment_nonce); 
    57  
    58                 if (isset($_POST['use_rtl'])) { 
    59                         update_option('mcecomment_rtl', '1'); 
    60                 } else { 
    61                         update_option('mcecomment_rtl', '0'); 
    62                 } 
    63  
    64                 if (isset($_POST['use_htmlsrc'])) { 
    65                         update_option('mcecomment_viewhtml', '1'); 
    66                 } else { 
    67                         update_option('mcecomment_viewhtml', '0'); 
    68                 } 
    69                  
    70                 if (isset($_POST['language'])) { 
    71                         update_option('mcecomment_lang', $_POST['language']); 
    72                 } else { 
    73                         update_option('mcecomment_lang', $_POST['language']); 
    74                 } 
    75          
    76                 if (isset($_POST['mcecomment_scripts'])) { 
    77                         update_option('mcecomment_scripts', '1'); 
    78                 } else { 
    79                         update_option('mcecomment_scripts', '0'); 
    80                 } 
    81  
    82                 if (isset($_POST['mcecomment_add_plugins'])) { 
    83                         $plugins = trim($_POST['mcecomment_add_plugins']); 
    84                         if ($plugins[strlen($plugins)-1] == ',') { 
    85                                 $plugins = substr($plugins, 0, -1); 
    86                         } 
    87                         update_option('mcecomment_add_plugins', $plugins); 
    88                 } 
    89  
    90                 if (isset($_POST['mcecomment_add_buttons'])) { 
    91                         $buttons = trim($_POST['mcecomment_add_buttons']); 
    92                         if ($buttons[strlen($buttons)-1] == ',') { 
    93                                 $buttons = substr($buttons, 0, -1); 
    94                         } 
    95                         update_option('mcecomment_add_buttons', $buttons); 
    96                 } 
    97              
    98                 if (isset($_POST['mcecomment_css'])) 
    99                         update_option('mcecomment_css', trim($_POST['mcecomment_css'])); 
    100         } 
    101 ?> 
    102  
    103 <?php if ( !empty($_POST ) ) : ?> 
    104 <div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div> 
    105 <?php endif; ?> 
    106         <div class="wrap"> 
    107 <h2>TinyMCEComments Options</h2> 
    108  
    109 <form method="post"> 
    110 <?php mceComment_nonce_field($mceComment_nonce);?> 
    111 <fieldset class="options">  
    112 <legend>Interface</legend>  
    113 <script type="text/javascript"> 
    114 //<![CDATA[ 
    115 function addplug(obj) { 
    116         var plugs = document.getElementById('mcecomment_add_plugins'); 
    117         if (plugs.value.length > 0){ 
    118                 plugs.value += ','; 
    119         } 
    120         plugs.value += obj.innerHTML; 
    121 } 
    122 //]]> 
    123 </script> 
    124 <table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">  
    125 <tr valign="top">  
    126 <th width="33%" scope="row">Language:</th>  
    127 <td><select name="language" id="language"> 
    128 <?php 
    129 $langs = getMCELangs(); 
    130 for ($i=0;$i<count($langs);$i++) echo "<option".($langs[$i] == get_option('mcecomment_lang')?' selected="selected"':'').">$langs[$i]</option>\n"; 
    131 ?> 
    132 </select> 
    133 </td></tr> 
    134 <tr valign="top">  
    135 <th>Options:</th> 
    136 <td> 
    137 <p><input name="use_rtl" type="checkbox" id="use_rtl" value="1" <?php echo (get_option('mcecomment_rtl') ? 'checked="checked"':'') ?>/> 
    138 <label for="use_linksupdate">Right-To-Left(RTL) Mode</label></p> 
    139  
    140 <p><input name="use_htmlsrc" type="checkbox" id="use_htmlsrc" value="1" <?php echo (get_option('mcecomment_viewhtml') ? 'checked="checked"':'') ?>  /> 
    141 <label for="use_linksupdate">Allow visitors to view HTML source of their comment</label></p> 
    142 <p><input name="mcecomment_scripts" type="checkbox" id="mcecomment_scripts" value="1" <?php echo (get_option('mcecomment_scripts') ? 'checked="checked"':'') ?>  /> 
    143 <label for="use_linksupdate">Display subscript/superscript buttons</label></p> 
    144 </td></tr></table> 
    145 </fieldset> 
    146 <fieldset class="options">  
    147 <legend>Advance Options</legend>  
    148 <table width="100%" cellspacing="2" cellpadding="5" class="optiontable editform">  
    149 <tr valign="top">  
    150 <th>Additional plugins:</th> 
    151 <td><input name="mcecomment_add_plugins" type="text" id="mcecomment_add_plugins" value="<?php echo get_option('mcecomment_add_plugins')?>" style="width:98%" />(separated with commas)<br />  
    152 Detected plugins: 
    153 <?php $pls = getMCEPlugins();  
    154 for ($i=0; $i<count($pls); $i++) { 
    155 echo '<a href="#" onclick="addplug(this);return false;">'.$pls[$i].'</a> ';  
    156 }?> 
    157 </td> 
    158 </tr><tr> 
    159 <th>Additional buttons:</th> 
    160 <td><input name="mcecomment_add_buttons" type="text" id="mcecomment_add_buttons" value="<?php echo get_option('mcecomment_add_buttons')?>" style="width:98%" /><br /> 
    161 seperated with commas 
    162 </td> 
    163 </tr><tr> 
    164 <th>User defined CSS:</th> 
    165 <td><input name="mcecomment_css" type="text" id="mcecomment_css" value="<?php echo get_option('mcecomment_css')?>" style="width:98%" /><br /> 
    166 Fully qualified URL required(Leave it blank to use default CSS) 
    167 </td></tr> 
    168 </table> 
    169 <p class="submit"> 
    170 <input type="hidden" name="action" value="update" /> 
    171 <input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path" /> 
    172 <input type="submit" name="submit" value="Update Options &raquo;" /> 
    173 </p> 
    174 </form> 
    175 </div> 
    176 <?php 
    177 } 
    178  
    179 function getContentCSS() { 
    180         global $wp_version; 
    181  
    182         if (get_option('mcecomment_css') != '') { 
    183                 return get_option('mcecomment_css'); 
    184         } elseif (strpos($wp_version, '2.5') === 0) { 
    185                 return get_settings('siteurl') . '/wp-includes/js/tinymce/wordpress.css'; 
    186         } else { 
    187                 return get_settings('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/wordpress.css'; 
    188         } 
    189 } 
    190  
    191 function addTinyMCESupport() { 
    192         global $post, $wp_version; 
    193  
    194         $tiny_mce_path = get_settings('siteurl'); 
    195         if (strpos($wp_version, '2.5') === 0) { 
    196                 //TODO: Gzip & cache support 
    197                 $tiny_mce_path .= '/wp-includes/js/tinymce/tiny_mce.js'; 
    198         } else { 
    199                 $tiny_mce_path .= '/wp-includes/js/tinymce/tiny_mce_gzip.php'; 
    200         } 
    201     if (('open' == $post-> comment_status) or ('comment' == $post-> comment_type) ) { ?> 
    202 <script type="text/javascript" src="<?php echo $tiny_mce_path; ?>"></script> 
    203 <script type="text/javascript"> 
    204 //<![CDATA[ 
    205 function brstonewline(element_id, html, body) { 
    206         html = html.replace(/<br\s*\/>/gi, '\n');; 
    207         return html; 
    208 } 
    209  
    210 function insertHTML(html) { 
    211         tinyMCE.execCommand('mceInsertContent',false, html); 
    212 } 
    213  
    214 tinyMCE.init({ 
    215         mode : "exact", 
    216         elements : "comment", 
    217         theme : "advanced", 
    218         theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,undo,redo,link,unlink<?php echo (get_option('mcecomment_viewhtml') ? ',code':''); echo (get_option('mcecomment_scripts') ? ',sub,sup':''); echo (get_option('mcecomment_add_buttons') == '' ? '':(','.get_option('mcecomment_add_buttons'))); ?>", 
    219         force_p_newlines : false, 
    220     force_br_newlines : true, 
    221         gecko_spellcheck : true, 
    222         content_css : "<?php echo getContentCSS();?>", 
    223         theme_advanced_buttons2 : "", 
    224         theme_advanced_buttons3 : "", 
    225         theme_advanced_toolbar_location : "top", 
    226         theme_advanced_toolbar_align : "left", 
    227         <?php echo (get_option('mcecomment_rtl') ? 'directionality : "rtl",'."\n":'') ?> 
    228         save_callback : "brstonewline", 
    229         language : "<?php echo get_option('mcecomment_lang') ?>", 
    230         entity_encoding : "raw", 
    231         plugins : "<?php echo get_option('mcecomment_add_plugins') ?>", 
    232         extended_valid_elements : "a[name|href|title],font[face|size|color|style],span[class|align|style]" 
    233 }); 
    234 document.getElementById('submit').onclick=function() { 
    235      var inst = tinyMCE.getInstanceById('comment'); 
    236      document.getElementById("comment").value = inst.getHTML();  
    237      //return false; 
    238 } 
    239 //]]> 
    240 </script> 
    241 <?php 
    242 }} 
    243 add_action('comment_form', 'addTinyMCESupport'); 
    244 add_action('admin_menu', 'mce_addAdminPages'); 
    245 add_option('mcecomment_rtl', '0', 'Make TinyMCE Comment Field supports RTL languages'); 
    246 add_option('mcecomment_viewhtml', '1', 'Allow visitors display html code in comment field'); 
    247 add_option('mcecomment_lang', 'en', 'TinyMCEComments Language'); 
    248 add_option('mcecomment_scripts', '0', 'Sub/superscripts in Comments'); 
    249 add_option('mcecomment_add_plugins', '', 'User supplied additional plugins'); 
    250 add_option('mcecomment_add_buttons', '', 'User supplied additional buttons'); 
    251 add_option('mcecomment_css', '', 'User supplied content_css'); 
    252 ?> 
     1<?php 
     2/* 
     3Plugin Name: TinyMCE Comments 
     4Plugin URI: http://mk.netgenes.org/my-plugins/mcecomments/ 
     5Description: A simple hack to enable WYSIWYG editor TinyMCE on the comment field. 
     6Version: 0.4.3-2 
     7Author: Thomas Au(MK) 
     8Author URI: http://mk.netgenes.org 
     9*/ 
     10 
     11if ( !function_exists('wp_nonce_field') ) { 
     12        function mcecomment_nonce_field($action = -1) { return; } 
     13        $mcecomment_nonce = -1; 
     14} else { 
     15        function mcecomment_nonce_field($action = -1) { return wp_nonce_field($action); } 
     16        $mcecomment_nonce = 'mcecomment-update-key'; 
     17} 
     18 
     19function mcecomment_adminpages() { 
     20        add_options_page('TinyMCE Comments Options', 'TinyMCE Comments', 8, 'tinyMCEComments', 'mcecomment_optionpage'); 
     21} 
     22 
     23//Get available plugins of TinyMCE 
     24function mcecomment_getplugins() { 
     25        if ($h = opendir(ABSPATH . 'wp-includes/js/tinymce/plugins')) { 
     26                while (($file = readdir($h)) !== false) { 
     27                        if (is_file(ABSPATH . 'wp-includes/js/tinymce/plugins/' . $file . '/editor_plugin.js'))  
     28                                $plugins[] = $file; 
     29                        } 
     30                closedir($h); 
     31        } 
     32 
     33        return $plugins; 
     34} 
     35 
     36//Get Available Languages in the directory 
     37function mcecomment_getlangs() { 
     38        if ($h = opendir(ABSPATH . 'wp-includes/js/tinymce/langs/')) { 
     39                while (($file = readdir($h)) !== false) { 
     40                        if (is_file(ABSPATH . 'wp-includes/js/tinymce/langs/' . $file) && strpos($file, '.js') !== false)  
     41                                $langs[] = basename($file, '.js'); 
     42                        } 
     43                closedir($h); 
     44        } 
     45 
     46        return $langs ? $langs : array('en'); 
     47} 
     48 
     49function mcecomment_optionpage() { 
     50        global $mcecomment_nonce; 
     51        $mcecomment_options = get_option('mcecomment_options'); 
     52 
     53        if ( isset($_POST['submit']) ) { 
     54                if ( function_exists('current_user_can') && !current_user_can('manage_options') ) 
     55                        die(__('Cheatin&#8217; uh?')); 
     56 
     57                check_admin_referer($mcecomment_nonce); 
     58 
     59                $mcecomment_options['language'] = (isset($_POST['mcecomment_language']) ? $_POST['mcecomment_language'] : $mcecomment_options['language']); 
     60                         
     61                $mcecomment_options['rtl'] = (isset($_POST['mcecomment_rtl']) ? '1' : '0'); 
     62                $mcecomment_options['viewhtml'] = (isset($_POST['mcecomment_viewhtml']) ? '1' : '0'); 
     63                $mcecomment_options['resize'] = (isset($_POST['mcecomment_resize']) ? '1' : '0'); 
     64 
     65                if (isset($_POST['mcecomment_buttons'])) { 
     66                        $buttons = trim($_POST['mcecomment_buttons']); 
     67                        if ($buttons[strlen($buttons)-1] == ',') { 
     68                                $buttons = substr($buttons, 0, -1); 
     69                        } 
     70                        $mcecomment_options['buttons'] = $buttons; 
     71                } 
     72 
     73                if (isset($_POST['mcecomment_plugins'])) { 
     74                        $plugins = trim($_POST['mcecomment_plugins']); 
     75                        if ($plugins[strlen($plugins)-1] == ',') { 
     76                                $plugins = substr($plugins, 0, -1); 
     77                        } 
     78                        $mcecomment_options['plugins'] = $plugins; 
     79                } 
     80 
     81                if (isset($_POST['mcecomment_css'])) 
     82                        $mcecomment_options['css'] = trim($_POST['mcecomment_css']); 
     83         
     84                update_option('mcecomment_options', $mcecomment_options); 
     85        } 
     86          
     87        mcecomment_init(); 
     88?> 
     89 
     90<?php if ( !empty($_POST ) ) :  
     91?> 
     92<div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div> 
     93<?php endif; ?> 
     94 
     95<div class="wrap"> 
     96<h2>TinyMCE Comments Options</h2> 
     97 
     98<form method="post"> 
     99<?php mcecomment_nonce_field($mcecomment_nonce);?> 
     100<h3>Interface</h3>  
     101<script type="text/javascript"> 
     102//<![CDATA[ 
     103function inserttext(obj_out,obj_in) { 
     104        obj = document.getElementById(obj_out); 
     105        obj.value += ((obj.value != '') ? ',' : '') + (obj_in).innerHTML; 
     106} 
     107//]]> 
     108</script> 
     109<table width="100%" cellspacing="2" cellpadding="5" class="form-table">  
     110<tr class="form-field">  
     111<th scope="row">Language:</th>  
     112<td><select name="mcecomment_language" id="mcecomment_language"> 
     113<?php 
     114$langs = mcecomment_getlangs(); 
     115for ($i=0;$i<count($langs);$i++) echo "<option".($langs[$i] == $mcecomment_options['language'] ? ' selected="selected"' : '') . ">$langs[$i]</option>\n"; 
     116?> 
     117</select> 
     118</td></tr> 
     119<tr class="form-field">  
     120<th>Options:</th> 
     121<td> 
     122<p><input name="mcecomment_rtl" type="checkbox" id="mcecomment_rtl" value="1" <?php echo ($mcecomment_options['rtl'] ? 'checked="checked"':''); ?>/> 
     123<label for="mcecomment_rtl">Enable right-to-left (RTL) editing mode in comment field</label></p> 
     124<p><input name="mcecomment_viewhtml" type="checkbox" id="mcecomment_viewhtml" value="1" <?php echo ($mcecomment_options['viewhtml'] ? 'checked="checked"':''); ?>  /> 
     125<label for="mcecomment_viewhtml">Enable HTML source editing of the comment field</label></p> 
     126<p><input name="mcecomment_resize" type="checkbox" id="mcecomment_resize" value="1" <?php echo ($mcecomment_options['resize'] ? 'checked="checked"':''); ?>  /> 
     127<label for="mcecomment_resize">Enable vertical resizing of the comment field writing area</label></p> 
     128</td></tr></table> 
     129 
     130<h3>Advance Options</h3>  
     131<table width="100%" cellspacing="2" cellpadding="5" class="form-table">  
     132<tr class="form-field"> 
     133<th>Buttons in use:</th> 
     134<td><input name="mcecomment_buttons" type="text" id="mcecomment_buttons" value="<?php echo $mcecomment_options['buttons']; ?>" style="width:98%" /><br /> 
     135(separated with commas)<br />  
     136Available buttons:  
     137<?php $pls = array('separator','bold','italic','underline','strikethrough','justifyleft','justifycenter','justifyright','justifyfull','bullist','numlist','outdent','indent','cut','copy','paste','undo','redo','link','unlink','cleanup','help','code','hr','removeformat','sub','sup','forecolor','backcolor','charmap','visualaid','blockquote','spellchecker','fullscreen'); 
     138for ($i=0; $i<count($pls); $i++) { 
     139echo '<span style="cursor: pointer; text-decoration: underline;" onclick="inserttext(\'mcecomment_buttons\', this);">'.$pls[$i].'</span>  ';  
     140}?> 
     141</td> 
     142</tr><tr class="form-field">  
     143<th>Plugins in use:</th> 
     144<td><input name="mcecomment_plugins" type="text" id="mcecomment_plugins" value="<?php echo $mcecomment_options['plugins']; ?>" style="width:98%" /><br /> 
     145(separated with commas)<br />  
     146Detected plugins:  
     147<?php $pls = mcecomment_getplugins();  
     148for ($i=0; $i<count($pls); $i++) { 
     149echo '<span style="cursor: pointer; text-decoration: underline;" onclick="inserttext(\'mcecomment_plugins\', this);">'.$pls[$i].'</span>  ';  
     150}?> 
     151</td> 
     152</tr><tr class="form-field"> 
     153<th>User defined CSS:</th> 
     154<td><input name="mcecomment_css" type="text" id="mcecomment_css" value="<?php echo $mcecomment_options['css']; ?>" style="width:98%" /><br /> 
     155Fully qualified URL required (leave blank to use default CSS) 
     156</td></tr> 
     157</table> 
     158 
     159<h3>Preview</h3>  
     160<table width="100%" cellspacing="2" cellpadding="5" class="form-table">  
     161<tr valign="top" class="form-field">  
     162<th>Preview:</th> 
     163<td>Update options to preview how the comment textarea box will appear.<br /><textarea name="comment" id="comment" rows="5" tabindex="4" style="width:99%">This is a preview textarea</textarea> 
     164</td></tr> 
     165</table> 
     166 
     167<p class="submit"> 
     168<input type="hidden" name="action" value="update" /> 
     169<input type="submit" name="submit" value="Update Options &raquo;" /> 
     170</p> 
     171</form> 
     172</div> 
     173<?php 
     174} 
     175 
     176function mcecomment_getcss() { 
     177        global $wp_version; 
     178        $mcecomment_options = get_option('mcecomment_options'); 
     179 
     180        if ($mcecomment_options['css'] != '') { 
     181                return $mcecomment_options['css']; 
     182        } elseif (strpos($wp_version, '2.5') === 0) { 
     183                return get_settings('siteurl') . '/wp-includes/js/tinymce/wordpress.css'; 
     184        } else { 
     185                return get_settings('siteurl') . '/wp-includes/js/tinymce/plugins/wordpress/wordpress.css'; 
     186        } 
     187} 
     188 
     189function mcecomment_init() { 
     190        global $post, $wp_version; 
     191        $mcecomment_options = get_option('mcecomment_options'); 
     192        if (!is_array($mcecomment_options)) 
     193        { 
     194                $mcecomment_options['language'] = 'en'; 
     195                $mcecomment_options['buttons'] = 'bold,italic,underline,|,strikethrough,|,bullist,numlist,|,undo,redo,|,link,unlink,|,removeformat'; 
     196                update_option('mcecomment_options', $mcecomment_options); 
     197        } 
     198 
     199        $mcecomment_mce_path = get_settings('siteurl'); 
     200        if (strpos($wp_version, '2.5') === 0) { 
     201                //TODO: Gzip & cache support 
     202                $mcecomment_mce_path .= '/wp-includes/js/tinymce/tiny_mce.js'; 
     203        } else { 
     204                $mcecomment_mce_path .= '/wp-includes/js/tinymce/tiny_mce_gzip.php'; 
     205        } 
     206        if (('open' == $post-> comment_status) or ('comment' == $post-> comment_type) or (is_plugin_page()) ) { ?> 
     207<script type="text/javascript" src="<?php echo $mcecomment_mce_path; ?>"></script> 
     208<script type="text/javascript"> 
     209//<![CDATA[ 
     210function brstonewline(element_id, html, body) { 
     211        html = html.replace(/<br\s*\/>/gi, '\n');; 
     212        return html; 
     213} 
     214 
     215function insertHTML(html) { 
     216        tinyMCE.execCommand('mceInsertContent',false, html); 
     217} 
     218 
     219tinyMCE.init({ 
     220        mode : 'exact', 
     221        elements : 'comment', 
     222        theme : 'advanced', 
     223        theme_advanced_buttons1 : "<?php echo $mcecomment_options['buttons']; ?>", 
     224        theme_advanced_buttons2 : "", 
     225        theme_advanced_buttons3 : "", 
     226        theme_advanced_toolbar_location : "top", 
     227        theme_advanced_toolbar_align : "left", 
     228        theme_advanced_statusbar_location : "<?php echo $mcecomment_options['resize'] ? 'bottom' : 'none'; ?>", 
     229        theme_advanced_resizing : <?php echo $mcecomment_options['resize'] ? 'true' : 'false'; ?>, 
     230        theme_advanced_resize_horizontal : false, 
     231        theme_advanced_disable : "<?php echo ($mcecomment_options['viewhtml'] ? '':'code'); ?>", 
     232 
     233        force_p_newlines : false, 
     234        force_br_newlines : true, 
     235        gecko_spellcheck : true, 
     236        content_css : "<?php echo mcecomment_getcss(); ?>", 
     237        directionality : "<?php echo ($mcecomment_options['rtl'] ? 'rtl' : 'ltr'); ?>", 
     238        save_callback : "brstonewline", 
     239        language : "<?php echo $mcecomment_options['language']; ?>", 
     240        entity_encoding : "raw", 
     241        plugins : "<?php echo $mcecomment_options['plugins']; ?>", 
     242        extended_valid_elements : "a[name|href|title],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]" 
     243}); 
     244 
     245document.getElementById('submit').onclick=function() { 
     246        var inst = tinyMCE.getInstanceById('comment'); 
     247        document.getElementById("comment").value = inst.getHTML();  
     248        //return false; 
     249} 
     250//]]> 
     251</script> 
     252<?php 
     253        } 
     254} 
     255 
     256add_action('comment_form', 'mcecomment_init'); 
     257add_action('admin_menu', 'mcecomment_adminpages'); 
     258 
     259add_option('mcecomment_options', '', 'TinyMCE Comments'); 
     260?>