Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('tiny_mce_before_init', 'esw_tiny_mce_before_init');
- function esw_tiny_mce_before_init($o) {
- # http://forum.semiologic.com/discussion/4807/iframe-code-disappears-switching-visualhtml/
- # http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/valid_elements#Full_XHTML_rule_set
- # assume the stuff below is properly set if they exist already
- if ( current_user_can('publish_posts') ){
- if ( !isset($o['extended_valid_elements']) ){
- $elts = array();
- $elts[] = "iframe[align<bottom?left?middle?right?top|class|frameborder|height|id"
- . "|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style"
- . "|title|width]";
- $elts = implode(',', $elts);
- $o['extended_valid_elements'] = $elts;
- }
- }
- else{
- if ( !isset($o['invalid_elements']) ){
- $elts = array();
- $elts[] = "iframe";
- $elts[] = "script";
- $elts = implode(',', $elts);
- $o['invalid_elements'] = $elts;
- }
- }
- return $o;
- }
- //add_filter( 'user_has_cap', 'esw_author_cap_filter', 10, 3 );
- add_filter( 'wp_kses_allowed_html', 'esw_author_cap_filter_tags',1,1 );
- function esw_author_cap_filter_tags( $allowedposttags ) {
- if ( !current_user_can( 'publish_posts' ) )
- return $allowedposttags;
- $allowedposttags['iframe']=array(
- 'align' => true,
- 'width' => true,
- 'height' => true,
- 'frameborder' => true,
- 'name' => true,
- 'src' => true,
- 'id' => true,
- 'class' => true,
- 'style' => true,
- 'scrolling' => true,
- 'marginwidth' => true,
- 'marginheight' => true,
- );
- $allowedposttags['code']=array();
- return $allowedposttags;
- }
- add_filter( 'safe_style_css', 'esw_author_cap_filter_css',1,1 );
- function esw_author_cap_filter_css( $allowedpostcss ) {
- $allowedpostcss[]='display';
- return $allowedpostcss;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement