Skip to:
Content

bbPress.org

Changeset 4606


Ignore:
Timestamp:
12/20/2012 01:18:32 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Filter the TeenyMCE buttons to remove buttons that users cannot use. Maybe allow images; commented out for now.

Location:
trunk/includes/common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/common/kses.php

    r4605 r4606  
    4242                'em'           => array(),
    4343                'strong'       => array(),
    44                 'span'         => array(
    45                         'style'    => true
    46                 ),
    4744                'del'          => array(
    4845                        'datetime' => true,
     
    5754
    5855                // Images
     56                /*
    5957                'img'          => array(
    6058                        'src'      => true,
     59                        'border'   => true,
    6160                        'alt'      => true,
    6261                        'height'   => true,
    6362                        'width'    => true,
    6463                )
     64                */
    6565        ) );
    6666}
  • trunk/includes/common/template-tags.php

    r4604 r4606  
    16901690
    16911691                        // Enable additional TinyMCE plugins before outputting the editor
    1692                         add_filter( 'tiny_mce_plugins',  'bbp_get_tiny_mce_plugins' );
    1693                         add_filter( 'teeny_mce_plugins', 'bbp_get_tiny_mce_plugins' );
     1692                        add_filter( 'tiny_mce_plugins',  'bbp_get_tiny_mce_plugins'  );
     1693                        add_filter( 'teeny_mce_plugins', 'bbp_get_tiny_mce_plugins'  );
     1694                        add_filter( 'teeny_mce_buttons', 'bbp_get_teeny_mce_buttons' );
    16941695
    16951696                        // Output the editor
     
    17081709
    17091710                        // Remove additional TinyMCE plugins after outputting the editor
    1710                         remove_filter( 'tiny_mce_plugins',  'bbp_get_tiny_mce_plugins' );
    1711                         remove_filter( 'teeny_mce_plugins', 'bbp_get_tiny_mce_plugins' );
     1711                        remove_filter( 'tiny_mce_plugins',  'bbp_get_tiny_mce_plugins'  );
     1712                        remove_filter( 'teeny_mce_plugins', 'bbp_get_tiny_mce_plugins'  );
     1713                        remove_filter( 'teeny_mce_buttons', 'bbp_get_teeny_mce_buttons' );
    17121714
    17131715                /**
     
    17601762
    17611763        return apply_filters( 'bbp_get_tiny_mce_plugins', $plugins );
     1764}
     1765
     1766/**
     1767 * Edit TinyMCE buttons to match allowedtags
     1768 *
     1769 * @since bbPress (r4605)
     1770 *
     1771 * @param array $buttons
     1772 * @see teeny_mce_buttons
     1773 * @return array
     1774 */
     1775function bbp_get_teeny_mce_buttons( $buttons = array() ) {
     1776
     1777        // Remove some buttons from TeenyMCE
     1778        $buttons = array_diff( $buttons, array(
     1779                'underline',
     1780                'justifyleft',
     1781                'justifycenter',
     1782                'justifyright'
     1783        ) );
     1784
     1785        // Images?
     1786        //array_push( $buttons, 'image' );
     1787
     1788        return apply_filters( 'bbp_get_teeny_mce_buttons', $buttons );
    17621789}
    17631790
Note: See TracChangeset for help on using the changeset viewer.