/**
* Checks if buttons are valid
*
* @param   string  $buttons  button names separated by a comma
* @return  string            button names separated by a comma
*/
function TMCE_checkButtons($buttons)
{
    static $allowedButtons = NULL;
    if ($allowedButtons === NULL) {
        $allowedButtons = TMCE_getButtons();
    }
    $retval = array();
    foreach (explode(',', $buttons) as $button) {
        if ($button === '|' or in_array($button, $allowedButtons)) {
            $retval[] = $button;
        }
    }
    return implode(',', $retval);
}
示例#2
0
/**
* Returns toolbar palette
*
* @return  string
*/
function TMCE_getPalette()
{
    global $LANG_TMCE;
    $enabled = '<p style="line-height: 2em;">';
    $disabled = '<p style="line-height: 2em;">';
    $allButtons = TMCE_getAllButtons();
    $allowedButtons = TMCE_getButtons();
    sort($allButtons);
    foreach ($allButtons as $button) {
        if (isset($LANG_TMCE[$button])) {
            $label = $LANG_TMCE[$button];
        } else {
            $label = $button;
        }
        if (in_array($button, $allowedButtons)) {
            $enabled .= '<span class="tmce_button" title="' . TMCE_esc($label) . '" style="color: white; background-color: #0000cc; padding: 3px;">' . TMCE_esc($button) . '</span>&nbsp;&nbsp; ';
        } else {
            $disabled .= '<span class="tmce_button" title="' . TMCE_esc($label) . '" style="color: white; background-color: #666666; padding: 3px;">' . TMCE_esc($button) . '</span>&nbsp;&nbsp; ';
        }
    }
    $enabled .= '</p>';
    $disabled .= '</p>';
    return array($enabled, $disabled);
}