sText();
}
// ----------------------------------------------
class WYLongTextElement extends WYElement
{
// instance variables
var $bHideEMailAddress;
function webyep_longText($sFieldName, $bGlobal, $deprecated1 = "", $bHide = false)
{
global $goApp;
$o =& new WYLongTextElement($sFieldName, $bGlobal, $bHide);
$s = $o->sDisplay();
if ($goApp->bEditMode) {
echo $o->sEditButtonHTML("edit-button-long-text.gif");
if (!$s) $s = $o->sName;
}
echo $s;
}
function WYLongTextElement($sN, $bG, $bHide)
{
global $goApp;
parent::WYElement($sN, $bG);
$this->sEditorPageName = $goApp->bIsiPhone ? "long-text-iphone.php":"long-text.php";
$this->iEditorWidth = 520;
$this->iEditorHeight = 450;
$this->sEditButtonCSSClass = "WebYepLongTextEditButton";
$this->bHideEMailAddress = $bHide;
$this->setVersion(WY_LONGTEXT_VERSION);
if (!isset($this->dContent[WY_DK_CONTENT])) $this->dContent[WY_DK_CONTENT] = "";
}
function sFieldNameForFile()
{
$s = parent::sFieldNameForFile();
$s = "lt-" . $s;
return $s;
}
function sText()
{
return $this->dContent[WY_DK_CONTENT];
}
function setText($s)
{
$this->dContent[WY_DK_CONTENT] = $s;
}
function _sFormatEMailLinks($sLine)
// also used by guestbook!
{
return preg_replace("/([-a-zA-Z0-9_.]+)@([-a-zA-Z0-9_.]+[-a-zA-Z0-9_])/", "", $sLine);
}
function _aSplitTableCells($sLine)
{
$i = 0;
$iLastStart = 0;
$iL = strlen($sLine);
$aCells = array();
while ($i < $iL) {
if ($sLine[$i] == '|' && ($i == 0 || $sLine[$i-1] != '\\')) {
$iLen = $i - $iLastStart;
if ($iLen > 0) $aCells[] = substr($sLine, $iLastStart, $iLen);
else $aCells[] = "";
$iLastStart = $i + 1;
}
$i++;
}
$iLen = $i - $iLastStart;
if ($iLen > 0) $aCells[] = substr($sLine, $iLastStart, $iLen);
return $aCells;
}
function _sFormatContent($sContent, $bHideEMailAddress)
// also used by guestbook as class method - do not use $this->!
{
global $goApp, $webyep_sCharset, $webyep_bOpenFullURLsInNewWindow;
$sHTMLStandard = $goApp->sHTMLStandard();
$sBR = $sHTMLStandard == "HTML" ? "
":"
";
$aOutLines = array();
$sASCIIBullets = chr(149) . chr(183) . "+";
if ($sContent) {
$sContent = str_replace("\r\n", "\n", $sContent);
$sContent = str_replace("\r", "\n", $sContent);
$aInLines = split("\n", $sContent);
}
else $aInLines = array();
$sOutLine = "";
$bInLI = false;
$bInTable = false;
$bNL = true;
$sListType = "";
$iListLevel = 0;
$iNumLines = count($aInLines);
$iLine = 0;
foreach ($aInLines as $sLine)
{
$bNL = true;
$sOutLine = "";
if (preg_match("/^([*$sASCIIBullets]+)[ \t]+/", $sLine, $aReg) && strpos($sLine, "|") == false) { // bullet list item
if (substr($aReg[1], 0, 1) == "+") $sListType = "ol";
else $sListType = "ul";
$iNewListLevel = strlen($aReg[1]);
$sLine = preg_replace("/^[*$sASCIIBullets]+[ \t]+/", "", $sLine);
if ($iNewListLevel > $iListLevel) {
$sOutLine .= "\n" . "<$sListType>\n";
}
else if ($iNewListLevel < $iListLevel) {
$sOutLine .= "\n";
while ($iNewListLevel != $iListLevel) {
$sOutLine .= "$sListType>\n";
$sOutLine .= "\n";
$iListLevel--;
}
}
else
$sOutLine .= "\n";
$iListLevel = $iNewListLevel;
$sOutLine .= "