formwysiwygtextarea.php
来自「php 开发的内容管理系统」· PHP 代码 · 共 718 行 · 第 1/3 页
PHP
718 行
break;
case "undo":
$form .= '<img alt="' . _XK_UNDO . '" title="' . _XK_UNDO . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'undo\',\'\',\'' . $this->getName() . '\')"/>';
break;
case "unlink":
$form .= '<img alt="' . _XK_UNLINK . '" title="' . _XK_UNLINK . '" src="' . $skinUrl . '/' . $tool . '.gif" onmousedown="XK_doTextFormat(\'unlink\',\'\',\'' . $this->getName() . '\')"/>';
break;
default:
break;
}
}
$form .= '</div></div>
<iframe class="' . $this->getSkin() . 'wIframe" id="iframe' . $this->getName() . '"style="height:' . $this->getHeight() . ';" frameBorder="0"></iframe>
<textarea wrap=soft id="' . $this->getName() . '" name="' . $this->getName() . '" rows="1" cols="1" style="display:none; width:' . $this->getWidth() . '; height:' . $this->getHeight() . '">' . $this->getValue() . '</textarea>
<div class="' . $this->getSkin() . 'statusBar">
<div class="' . $this->getSkin() . 'smileysBar">' . $this->_renderWysiwygSmileys() . '</div>';
$form .= '<div class="' . $this->getSkin() . 'htmlBar">';
if ($toggleMode)$form .= '<div class="' . $this->getSkin() . 'htmlBar"><input type="checkbox" alt="' . _XK_TOGLE_MODE . '" title="' . _XK_TOGLE_MODE . '" onclick="XK_doToggleView(\'' . $this->getName() . '\')" />HTML</div>';
if ($themeCss)$form .= '<div class="' . $this->getSkin() . 'htmlBar"><input type="checkbox" alt="' . _XK_ENABLECSS_MODE . '" title="' . _XK_ENABLECSS_MODE . '" id="cssEnabled' . $this->getName() . '" onclick="XK_appendXoopsCss(\'' . $this->getName() . '\',\'' . $this->getThemeCSS() . '\')" />CSS </div>';
$form .= '</div>';
$form .= '</div>';
// Render additional DIV'S
if ($colorPalette) {
include_once XOOPS_ROOT_PATH . '' . $this->getUrl() . '/class/colorpalette.class.php';
$palette = new WysiwygColorPalette('XK_applyColor', $this->getName(), $url, $this->getSkin());
$extraDivs .= $palette->_renderColorPalette();
}
$extraDivs .= $this->_renderContextMenu();
$form .= $extraDivs;
$form .= '<input type="hidden" value="off" id="borderstoggle' . $this->getName() . '"/>';
$form .= '<img alt="" width="0" height="0" src="' . $url . '/skins/common/blank.gif" onload="XK_init(\'' . $this->getName() . '\',\'' . $isie . '\',\'' . $url . '\',\'' . $this->getDirection() . '\')"/>';
$form .= '</div>';
return $form;
}
function _renderWysiwygSmileys()
{
$myts = &MyTextSanitizer::getInstance();
$url = XOOPS_URL . '' . $this->getUrl();
$ret = '';
$db = &Database::getInstance();
$result = $db->query('SELECT * FROM ' . $db->prefix('smiles') . ' WHERE display=1');
while ($smiles = $db->fetchArray($result)) {
$ret .= '<img onmousedown="XK_InsertImage(\'' . $this->getName() . '\',\'' . XOOPS_UPLOAD_URL . '/' . htmlspecialchars($smiles["smile_url"], ENT_QUOTES) . '\',\'\');" src="' . XOOPS_UPLOAD_URL . '/' . htmlspecialchars($smiles["smile_url"], ENT_QUOTES) . '" alt="" />';
}
$ret .= ' [<a href="#moresmiley" onmousedown="javascript:openWithSelfMain(\'' . $url . '/dialogs.php?id=' . $this->getName() . '&dialog=smilies&url=' . $this->getUrl() . '\',\'smilies\',300,475);">' . _MORE . '</a>]';
return $ret;
}
function _renderTableProps()
{
$url = XOOPS_URL . '' . $this->getUrl();
$skinUrl = $url . '/skins/' . $this->getSkin();
$ret = '
<div name="XoopsKToolbarDivs" id="TableOps' . $this->getName() . '" class="' . $this->getSkin() . 'tablePropsD" style="display:none;">
<img title="' . _XK_INSERTCELL . '" alt="' . _XK_INSERTCELL . '" src="' . $skinUrl . '/insertcell.gif" onmousedown="XK_useTableOps(\'insertCell\',\'' . $this->getName() . '\');" /><br />
<img title="' . _XK_DELCELL . '" alt="' . _XK_DELCELL . '" src="' . $skinUrl . '/delcell.gif" onmousedown="XK_useTableOps(\'deleteCell\',\'' . $this->getName() . '\');" /><br />
<img title="' . _XK_INSERTROW . '" alt="' . _XK_INSERTROW . '" src="' . $skinUrl . '/insertrow.gif" onmousedown="XK_useTableOps(\'insertRow\',\'' . $this->getName() . '\');" /><br />
<img title="' . _XK_DELROW . '" alt="' . _XK_DELROW . '" src="' . $skinUrl . '/delrow.gif" onmousedown="XK_useTableOps(\'deleteRow\',\'' . $this->getName() . '\');" /><br />
<img title="' . _XK_MOREROWSPAN . '" alt="' . _XK_MOREROWSPAN . '" src="' . $skinUrl . '/morerowspan.gif" onmousedown="XK_useTableOps(\'increaseRowSpan\',\'' . $this->getName() . '\');" /><br />
<img title="' . _XK_LESSROWSPAN . '" alt="' . _XK_LESSROWSPAN . '" src="' . $skinUrl . '/lessspan.gif" onmousedown="XK_useTableOps(\'decreaseRowSpan\',\'' . $this->getName() . '\');" /><br />
<img title="' . _XK_INSERTCOL . '" alt="' . _XK_INSERTCOL . '" src="' . $skinUrl . '/insertcol.gif" onmousedown="XK_useTableOps(\'insertCol\',\'' . $this->getName() . '\');" /><br />
<img title="' . _XK_DELCOL . '" alt="' . _XK_DELCOL . '" src="' . $skinUrl . '/delcol.gif" onmousedown="XK_useTableOps(\'deleteCol\',\'' . $this->getName() . '\');" /><br />
<img title="' . _XK_MORECOLSPAN . '" alt="' . _XK_MORECOLSPAN . '" src="' . $skinUrl . '/morespan.gif" onmousedown="XK_useTableOps(\'increaseSpan\',\'' . $this->getName() . '\');" /><br />
<img title="' . _XK_LESSCOLSPAN . '" alt="' . _XK_LESSCOLSPAN . '" src="' . $skinUrl . '/lessspan.gif" onmousedown="XK_useTableOps(\'decreaseSpan\',\'' . $this->getName() . '\');" />
</div>
';
return $ret;
}
function _renderCellAlign()
{
$url = XOOPS_URL . '' . $this->getUrl();
$skinUrl = $url . '/skins/' . $this->getSkin();
$mouseover = 'onmouseover="this.style.background=\'#B6BDD2\';" onmouseout="this.style.background=\'#FFFFFF\';"';
$ret = '<div name="XoopsKToolbarDivs" class="' . $this->getSkin() . 'cellAlignD" id="CellAlign' . $this->getName() . '" style="display: none;">
<table border="0" cellspacing="8" cellpadding="0" style="width:80px;">
<tr>
<td ' . $mouseover . ' ><img alt="' . _XK_CELLALIGNLEFTTOP . '" title="' . _XK_CELLALIGNLEFTTOP . '" src="' . $skinUrl . '/lefttop.gif" onmousedown="XK_cellAlign(\'' . $this->getName() . '\',\'left\',\'top\')"/></td>
<td ' . $mouseover . '><img alt="' . _XK_CELLALIGNCENTERTOP . '" title="' . _XK_CELLALIGNCENTERTOP . '" src="' . $skinUrl . '/centertop.gif" onmousedown="XK_cellAlign(\'' . $this->getName() . '\',\'center\',\'top\')"/></td>
<td ' . $mouseover . '><img alt="' . _XK_CELLALIGNRIGHTTOP . '" title="' . _XK_CELLALIGNRIGHTTOP . '" src="' . $skinUrl . '/righttop.gif" onmousedown="XK_cellAlign(\'' . $this->getName() . '\',\'right\',\'top\')"/></td>
</tr>
<tr>
<td ' . $mouseover . '><img alt="' . _XK_CELLALIGNLEFTMIDDLE . '" title="' . _XK_CELLALIGNLEFTMIDDLE . '" src="' . $skinUrl . '/leftmiddle.gif" onmousedown="XK_cellAlign(\'' . $this->getName() . '\',\'left\',\'middle\')"/></td>
<td ' . $mouseover . '><img alt="' . _XK_CELLALIGNCENTERMIDDLE . '" title="' . _XK_CELLALIGNCENTERMIDDLE . '" src="' . $skinUrl . '/centermiddle.gif" onmousedown="XK_cellAlign(\'' . $this->getName() . '\',\'center\',\'middle\')"/></td>
<td ' . $mouseover . '><img alt="' . _XK_CELLALIGNRIGHTMIDDLE . '" title="' . _XK_CELLALIGNRIGHTMIDDLE . '" src="' . $skinUrl . '/rightcenter.gif" onmousedown="XK_cellAlign(\'' . $this->getName() . '\',\'right\',\'middle\')"/></td>
</tr>
<tr>
<td ' . $mouseover . '><img alt="' . _XK_CELLALIGNLEFTBOTTOM . '" title="' . _XK_CELLALIGNLEFTBOTTOM . '" src="' . $skinUrl . '/leftbottom.gif" onmousedown="XK_cellAlign(\'' . $this->getName() . '\',\'left\',\'bottom\')"/></td>
<td ' . $mouseover . '><img alt="' . _XK_CELLALIGNCENTERBOTTOM . '" title="' . _XK_CELLALIGNCENTERBOTTOM . '" src="' . $skinUrl . '/centerbottom.gif" onmousedown="XK_cellAlign(\'' . $this->getName() . '\',\'center\',\'bottom\')"/></td>
<td ' . $mouseover . '><img alt="' . _XK_CELLALIGNRIGHTBOTTOM . '" title="' . _XK_CELLALIGNRIGHTBOTTOM . '" src="' . $skinUrl . '/rightbottom.gif" onmousedown="XK_cellAlign(\'' . $this->getName() . '\',\'right\',\'bottom\')"/></td>
</tr>
</table>
</div>';
return $ret;
}
function _renderCleanFormats()
{
$url = XOOPS_URL . '' . $this->getUrl();
$skinUrl = $url . '/skins/' . $this->getSkin();
$mouseover = 'onmouseover="this.style.background=\'#B6BDD2\';" onmouseout="this.style.background=\'#FFFFFF\';"';
$ret = '<div name="XoopsKToolbarDivs" class="' . $this->getSkin() . 'ClearFormatsD" id="RemoveFormat' . $this->getName() . '" style="display: none;">
<div ' . $mouseover . ' onmousedown="XK_removeFormat(\'' . $this->getName() . '\',\'lineBreaks\');" class="' . $this->getSkin() . 'DivOption">' . _XK_REMOVE_LINEBREAKS . '</div>
<div ' . $mouseover . ' onmousedown="XK_removeFormat(\'' . $this->getName() . '\',\'span\');" class="' . $this->getSkin() . 'DivOption">' . _XK_REMOVE_SPANF . '</div>
<div ' . $mouseover . ' onmousedown="XK_removeFormat(\'' . $this->getName() . '\',\'font\');" class="' . $this->getSkin() . 'DivOption">' . _XK_REMOVE_FONTF . '</div>
<div ' . $mouseover . ' onmousedown="XK_removeFormat(\'' . $this->getName() . '\',\'word\');" class="' . $this->getSkin() . 'DivOption">' . _XK_REMOVE_WORDF . '</div>
<div ' . $mouseover . ' onmousedown="XK_removeFormat(\'' . $this->getName() . '\',\'empty\');" class="' . $this->getSkin() . 'DivOption">' . _XK_REMOVE_EMPTYF . '</div>
<div ' . $mouseover . ' onmousedown="XK_removeFormat(\'' . $this->getName() . '\',\'all\');" class="' . $this->getSkin() . 'DivOption">' . _XK_REMOVE_ALLF . '</div>
</div>';
return $ret;
}
function _renderCellBorders()
{
$url = XOOPS_URL . '' . $this->getUrl();
$skinUrl = $url . '/skins/' . $this->getSkin();
$ret = '<div name="XoopsKToolbarDivs" class="' . $this->getSkin() . 'cellBordersD" style="display:none;" id="CellBorders' . $this->getName() . '">
<table border="0" cellspacing="8" cellpadding="0" width=100%>
<tr >
<td onmousedown="XK_quickBorders(\'' . $this->getName() . '\',\'all\',\'Black\')" style="border:1px solid black;" onmouseover="this.style.background=\'#B6BDD2\';" onmouseout="this.style.background=\'#FFFFFF\';"> </td>
<td onmousedown="XK_quickBorders(\'' . $this->getName() . '\',\'left\',\'Black\')" style="border:1px dotted silver; border-left:1px solid black;" onmouseover="this.style.background=\'#B6BDD2\';" onmouseout="this.style.background=\'#FFFFFF\';"> </td>
<td onmousedown="XK_quickBorders(\'' . $this->getName() . '\',\'right\',\'Black\')" style="border:1px dotted silver;border-right:1px solid black;" onmouseover="this.style.background=\'#B6BDD2\';" onmouseout="this.style.background=\'#FFFFFF\';"> </td>
</tr>
<tr >
<td onmousedown="XK_quickBorders(\'' . $this->getName() . '\',\'none\',\'Black\')" style="border:1px dotted silver;" onmouseover="this.style.background=\'#B6BDD2\';" onmouseout="this.style.background=\'#FFFFFF\';"> </td>
<td onmousedown="XK_quickBorders(\'' . $this->getName() . '\',\'top\',\'Black\')" style="border:1px dotted silver;border-top:1px solid black;" onmouseover="this.style.background=\'#B6BDD2\';" onmouseout="this.style.background=\'#FFFFFF\';"> </td>
<td onmousedown="XK_quickBorders(\'' . $this->getName() . '\',\'bottom\',\'Black\')" style="border:1px dotted silver;border-bottom:1px solid black;" onmouseover="this.style.background=\'#B6BDD2\';" onmouseout="this.style.background=\'#FFFFFF\';"> </td>
</tr>
</table>
</div>';
return $ret;
}
function _renderContextMenu()
{
$url = XOOPS_URL . '' . $this->getUrl();
$skinUrl = $url . '/skins/' . $this->getSkin();
$mouseover = 'onmouseover="this.style.background=\'#B6BDD2\';" onmouseout="this.style.background=\'none\';"';
$ret = '<div name="XoopsKToolbarDivs" id="xkcontextmenu' . $this->getName() . '" class="' . $this->getSkin() . 'contextMenu" style="display:none;">';
$ret .= ' <div ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_doTextFormat(\'cut\',\'\',\'' . $this->getName() . '\')" ><img alt="" src="' . $skinUrl . '/cut.gif" />' . _XK_CUT . '</div>
<div ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_doTextFormat(\'copy\',\'\',\'' . $this->getName() . '\')" ><img alt="" src="' . $skinUrl . '/copy.gif" />' . _XK_COPY . '</div>
<div ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_doTextFormat(\'paste\',\'\',\'' . $this->getName() . '\')" ><img alt="" src="' . $skinUrl . '/paste.gif" />' . _XK_PASTE . '</div>';
$ret .= ' <div class="' . $this->getSkin() . 'contextLast" ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_doTextFormat(\'removeformat\',\'\',\'' . $this->getName() . '\')" ><img alt="" src="' . $skinUrl . '/removeformat.gif"/>' . _XK_REMOVEFORMAT . '</div>
<div id="xklinkcontext' . $this->getName() . '" style="display:none;" class="' . $this->getSkin() . 'contextLast" ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_doTextFormat(\'unlink\',\'\',\'' . $this->getName() . '\')" ><img alt="" src="' . $skinUrl . '/unlink.gif" />' . _XK_UNLINK . '</div>
<div id="xkimagecontext' . $this->getName() . '" class="' . $this->getSkin() . 'contextLast" ' . $mouseover . ' style="display:none;" onmousedown="this.style.background=\'none\';XK_openPopup(\'' . $url . '/dialogs.php?id=' . $this->getName() . '&dialog=imageProps&url=' . $this->getUrl() . '&skin=' . $this->getSkin() . '\',\'table\',400,260)"><img alt="" src="' . $skinUrl . '/imageprops.gif" />' . _XK_EDITIMAGE . '</div>
<div id="xktablecontext' . $this->getName() . '" style="display:none;">
<div ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_TTools(\'' . $this->getName() . '\',\'' . $url . '/dialogs.php?id=' . $this->getName() . '&dialog=tableProps&skin=' . $this->getSkin() . '&url=' . $this->getUrl() . '\',\'table\',400,260)" ><img alt="" " src="' . $skinUrl . '/tableprops.gif" />' . _XK_TABLEPROPS . '</div>
<div class="' . $this->getSkin() . 'contextLast" ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_TTools(\'' . $this->getName() . '\',\'' . $url . '/dialogs.php?id=' . $this->getName() . '&dialog=cellProps&skin=' . $this->getSkin() . '&url=' . $this->getUrl() . '\',\'table\',400,260)" ><img alt="" src="' . $skinUrl . '/cellborders.gif" />' . _XK_CELLPROPS . '</div>
<div ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_useTableOps(\'insertCell\',\'' . $this->getName() . '\');" ><img alt="" src="' . $skinUrl . '/insertcell.gif" />' . _XK_INSERTCELL . '</div>
<div class="' . $this->getSkin() . 'contextLast" ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_useTableOps(\'deleteCell\',\'' . $this->getName() . '\');" ><img alt="" src="' . $skinUrl . '/delcell.gif" />' . _XK_DELCELL . '</div>
<div ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_useTableOps(\'insertRow\',\'' . $this->getName() . '\');" ><img alt="" src="' . $skinUrl . '/insertrow.gif" />' . _XK_INSERTROW . '</div>
<div ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_useTableOps(\'deleteRow\',\'' . $this->getName() . '\');" ><img alt="" src="' . $skinUrl . '/delrow.gif" />' . _XK_DELROW . '</div>
<div ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_useTableOps(\'increaseRowSpan\',\'' . $this->getName() . '\');" ><img alt="" src="' . $skinUrl . '/morerowspan.gif" />' . _XK_MOREROWSPAN . '</div>
<div class="' . $this->getSkin() . 'contextLast" ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_useTableOps(\'decreaseRowSpan\',\'' . $this->getName() . '\');" ><img alt="" src="' . $skinUrl . '/lessspan.gif" />' . _XK_LESSROWSPAN . '</div>
<div ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_useTableOps(\'insertCol\',\'' . $this->getName() . '\');" ><img alt="" src="' . $skinUrl . '/insertcol.gif" />' . _XK_INSERTCOL . '</div>
<div ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_useTableOps(\'deleteCol\',\'' . $this->getName() . '\');" ><img alt="" src="' . $skinUrl . '/delcol.gif" />' . _XK_DELCOL . '</div>
<div ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_useTableOps(\'increaseSpan\',\'' . $this->getName() . '\');" ><img alt="" src="' . $skinUrl . '/morespan.gif" />' . _XK_MORECOLSPAN . '</div>
<div class="' . $this->getSkin() . 'contextLast" ' . $mouseover . ' onmousedown="this.style.background=\'none\';XK_useTableOps(\'decreaseSpan\',\'' . $this->getName() . '\');" ><img alt="" src="' . $skinUrl . '/lessspan.gif" />' . _XK_LESSCOLSPAN . '</div>
</div>';
$ret .= '</div>';
return $ret;
}
function _renderQuickTable()
{
$url = XOOPS_URL . '' . $this->getUrl();
$ret = '<div name="XoopsKToolbarDivs" class="' . $this->getSkin() . 'quickTableD" style=" display:none; " id="tablepicker' . $this->getName() . '">';
$ret .= '<table style="width:80px;" >';
for ($i = 1;$i < 8;$i++) {
$ret .= '<tr>';
for ($j = 1;$j < 8;$j++) {
$ret .= '<td class=\'' . $this->getSkin() . 'tdPicker\' id="' . $this->getName() . '-' . $i . '-' . $j . '" bgcolor="#FFFFFF" onmouseover="XK_tableOver(\'' . $this->getName() . '\',\'' . $i . '\',\'' . $j . '\')" onmouseout="XK_tableOut(\'' . $this->getName() . '\',\'' . $i . '\',\'' . $j . '\')" onmousedown="XK_tableClick(\'' . $this->getName() . '\',\'' . $i . '\',\'' . $j . '\')"><img alt="" width="5" height="5" src="' . $url . '/skins/common/blank.gif" /></td>';
}
$ret .= '</tr>';
}
$ret .= '</table></div>';
return $ret;
}
function _renderInsertSymbols()
{
$url = XOOPS_URL . '' . $this->getUrl();
$symbols = Array("{", "|", "}", "~", "€", "‘", "’", "“", "”", "–", "—", "¡", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "®", "¯", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ü", "ý", "þ", "ÿ") ;
$length = sizeof($symbols);
$i = 0;
$ret = ' <select id="insertsymbol' . $this->getName() . '" class="' . $this->getSkin() . 'selectInput" name="select' . $this->getName() . '" onchange=\'XK_insertSymbol(this.options[this.selectedIndex].value, "' . $this->getName() . '")\'>';
$ret .= '<option value="" selected="selected">' . _XK_SYMBOLS . '</option>';
while ($i < $length) {
$ret .= '<option value="' . $symbols[$i] . '">' . $symbols[$i] . '</option>';
$i++;
}
$ret .= '</select>';
return $ret;
}
/**
* Check if compatible
*
* @return
*/
function isCompatible()
{
if ( !is_readable(XOOPS_ROOT_PATH . _XK_P_PATH. "/include/functions.inc.php")) {
return false;
}
include_once(XOOPS_ROOT_PATH . _XK_P_PATH. "/include/functions.inc.php");
return checkBrowser(false);
}
}
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?