Advertisement
chipbennett

Untitled

Mar 18th, 2011
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.73 KB | None | 0 0
  1. /*****************************************************************************************
  2. * Customize TinyMCE Configuration
  3. *******************************************************************************************/
  4.  
  5. // http://tinymce.moxiecode.com/wiki.php/Configuration
  6. function cbnet_tinymce_config( $init ) {
  7.  
  8. // Change code cleanup/content filtering config
  9.    
  10.     // Don't remove line breaks
  11.     $init['remove_linebreaks'] = false;
  12.     // Convert newline characters to BR tags
  13.     //$init['convert_newlines_to_brs'] = true;
  14.     // Preserve tab/space whitespace
  15.     $init['preformatted'] = true;
  16.     // Add to list of formats to remove with Remove Format button
  17.     $init['removeformat_selector'] = 'b,strong,em,i,span,ins,del,h1,h2,h3,h4,h5,h6,pre';
  18.     // Do not remove redundant BR tags
  19.     $init['remove_redundant_brs'] = false;
  20.    
  21. // Add to list of valid HTML elements (so they don't get stripped)
  22.  
  23.     // IFRAME
  24.     $valid_iframe = 'iframe[id|class|title|style|align|frameborder|height|longdesc|marginheight|marginwidth|name|scrolling|src|width]';
  25.     // PRE
  26.     $valid_pre = 'pre[id|name|class|style]';
  27.     // DIV
  28.     $valid_div = 'div[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title]';
  29.  
  30.     // Concatenate
  31.     $cbnet_valid_elements = $valid_iframe . ',' . $valid_pre . ',' . $valid_div;
  32.  
  33.     // Add to extended_valid_elements if it alreay exists
  34.     if ( isset( $init['extended_valid_elements'] ) ) {
  35.         $init['extended_valid_elements'] .= ',' . $cbnet_valid_elements;
  36.     } else {
  37.         $init['extended_valid_elements'] = $cbnet_valid_elements;
  38.     }
  39.  
  40. // Pass $init back to WordPress
  41.     return $init;
  42. }
  43. add_filter('tiny_mce_before_init', 'cbnet_tinymce_config');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement