__controlName = "";
$this->__controlWidth = 0;
$this->__controlHeight = 0;
$this->__initialValue = "";
$this->__initialValueNoBase = "";
$this->__langPack = 0;
$this->__hideCopy = 0;
$this->__hideCut = 0;
$this->__hidePaste = 0;
$this->__hideSave = 0;
$this->__hideSpelling = 0;
$this->__hideRemoveTextFormatting = 0;
$this->__hideFullScreen = 0;
$this->__hideBold = 0;
$this->__hideUnderline = 0;
$this->__hideItalic = 0;
$this->__hideStrikethrough = 0;
$this->__hideNumberList = 0;
$this->__hideBulletList = 0;
$this->__hideDecreaseIndent = 0;
$this->__hideIncreaseIndent = 0;
$this->__hideSuperScript = 0;
$this->__hideSubScript = 0;
$this->__hideLeftAlign = 0;
$this->__hideCenterAlign = 0;
$this->__hideRightAlign = 0;
$this->__hideJustify = 0;
$this->__hideHorizontalRule = 0;
$this->__hideLink = 0;
$this->__hideAnchor = 0;
$this->__hideMailLink = 0;
$this->__hideHelp = 0;
$this->__hideFont = 0;
$this->__hideSize = 0;
$this->__hideFormat = 0;
$this->__hideStyle = 0;
$this->__hideForeColor = 0;
$this->__hideBackColor = 0;
$this->__hideTable = 0;
$this->__hideForm = 0;
$this->__hideImage = 0;
$this->__hideFlash = 0;
$this->__hideFile = 0;
$this->__hideMedia = 0;
$this->__hideCustom = 0;
$this->__flashPath = "";
$this->__mediaPath = "";
$this->__hideTextBox = 0;
$this->__hideSymbols = 0;
$this->__hideProps = 0;
$this->__hideWord = 0;
$this->__hideAbsolute = 0;
$this->__hideClean = 0;
$this->__hideGuidelines = 0;
$this->__hidePositionAbsolute = 0;
$this->__disableSourceMode = 0;
$this->__disablePreviewMode = 0;
$this->__guidelinesOnByDefault = 0;
$this->__imagePath = "";
$this->__hasFlashLibraries = false;
$this->__flashLibsArray = array();
$this->__baseHref = "";
$this->__numTopHidden = 0;
$this->__numBottomHidden = 0;
$this->__imagePathType = 0;
$this->__docType = 0;
$this->__imageDisplayType = 0;
$this->__flashDisplayType = 0;
$this->__disableImageUploading = 0;
$this->__disableImageDeleting = 0;
$this->__disableFlashUploading = 0;
$this->__disableFlashDeleting = 0;
$this->__disableMediaUploading = 0;
$this->__disableMediaDeleting = 0;
$this->__enableXHTMLSupport = 1;
$this->__useSingleLineReturn = 1;
$this->__customInsertArray = array();
$this->__customLinkArray = array();
$this->__toolbarset = array();
$this->__toolbarsetnames = array();
$this->__hasCustomInserts = false;
$this->__hasCustomLinks = false;
$this->__snippetCSS = "";
$this->__textareaRows = 10;
$this->__textareaCols = 30;
$this->__fontNameList = "";
$this->__fontSizeList = "";
$this->__hideWebImage = 0;
$this->__hideWebFlash = 0;
$this->__language = 0;
$this->__imageLibsArray = array();
$this->__skinName = "default";
$this->__hasImageLibraries = false;
$this->__styles = "";
$this->__linkPath = "";
if (@$_COOKIE["de_mode"]) {
$this->__modeName = $_COOKIE["de_mode"];
} else {
$this->__modeName = "";
}
}
function SetLinkPath($p){
$this->__linkPath = $p;
}
function SetName($CtrlName)
{
$this->__controlName = $CtrlName;
}
function SetStyles($style)
{
$this->__styles = $style;
}
function SetWidth($Width)
{
$this->__controlWidth = $Width;
}
function SetHeight($Height)
{
$this->__controlHeight = $Height;
}
//modified for v5.0
function SetBaseHref($BaseHref)
{
$this->__baseHref = $BaseHref;
}
function SetFlashPath($FlashPath)
{
$this->__flashPath = $FlashPath;
}
function SetMediaPath($Path)
{
$this->__mediaPath = $Path;
}
function SetValue($HTMLValue)
{
// modified for v5.0
$this->__initialValueNoBase = $HTMLValue;
if($this->__docType == DE_DOC_TYPE_SNIPPET)
{
if($this->__baseHref != "")
{
$HTMLValue = "
tag for a new line, add
instead
$this->__useSingleLineReturn = 0;
}
function LoadHTMLFromMySQLQuery($DatabaseServer, $DatabaseName, $DatabaseUser, $DatabasePassword, $DatabaseQuery, &$ErrorDesc)
{
// Grabs a value from a MySQL database based on a SELECT query.
// It will return a text value from the field on success, or false on failure
if(!$sConn = @mysql_connect($DatabaseServer, $DatabaseUser, $DatabasePassword))
{
// Server connection failed
$ErrorDesc = mysql_error();
return false;
}
else
{
// Server connection was successful
if(! $dConn = @mysql_select_db($DatabaseName, $sConn))
{
// Database connection failed
$ErrorDesc = mysql_error();
return false;
}
else
{
// Database connection was successful
if(! $mResult = @mysql_query($DatabaseQuery))
{
// Query Failed
$ErrorDesc = mysql_error();
return false;
}
else
{
// Query was OK. Did it return a row?
if(@mysql_num_rows($mResult) == 0)
{
// No rows returned
$ErrorDesc = mysql_error();
return false;
}
else
{
// Grab the first row's contents and return it
if(! $mRow = mysql_fetch_row($mResult))
{
// Error returning row
$ErrorDesc = mysql_error();
return false;
}
else
{
// Set the contents of the DevEdit control to this value
$this->SetValue($mRow[0]);
return true;
}
}
}
}
}
}
function LoadFromFile($FilePath, &$ErrorDesc)
{
// Grabs the contents of a file and sets the value
// of the DevEdit control to the text in this file
if(! $fp = @fopen($FilePath, "rb"))
{
// Failed to open the file
$ErrorDesc = "Failed to open file $FilePath";
return false;
}
else
{
$data = "";
// File was opened OK, read it in
while(!feof($fp))
{
$data .= fgets($fp, 4096);
}
// Set the value to the contents of this file
$this->SetValue($data);
return true;
}
}
function SaveToFile($FilePath, &$ErrorDesc)
{
// Writes the contents of the DevEdit control to a file
if(strlen($this->GetValue(false)) == 0)
{
// No data to write to the file
$ErrorDesc = "Cannot save an empty value to $FilePath";
return false;
}
else
{
// The form has been submitted, save its contents
if(! $fp = @fopen($FilePath, "w"))
{
// Failed to open the file
$ErrorDesc = "Failed to open file $FilePath";
return false;
}
else
{
// File was opened OK, write to it
if(! is_writable($FilePath))
{
// Can't write to the file
$ErrorDesc = "You do not have write permissions for $FilePath";
return false;
}
else
{
if(! fwrite($fp, $this->GetValue(false)))
{
// Failed to write to the file
$ErrorDesc = "An error occured while writing to $FilePath";
return false;
}
else
{
// Write went OK
return true;
}
}
}
}
}
function AddCustomInsert($InsertName, $InsertHTMLCode)
{
$this->__hasCustomInserts = true;
$this->__customInsertArray[] = array("Name" => $InsertName, "HTML" => $InsertHTMLCode);
}
//Added for v5.0
function AddCustomLink($LinkName, $LinkURL, $TargetWindow = "")
{
$this->__hasCustomLinks = true;
$this->__customLinkArray[] = array("Name" => $LinkName, "URL" => $LinkURL, "Target" => $TargetWindow);
}
//Added for v5.0
function AddImageLibrary($LibraryName, $LibraryPath)
{
if(!in_array($LibraryName, $this->__imageLibsArray))
{
$this->__hasImageLibraries = true;
$this->__imageLibsArray[] = array($LibraryName, $LibraryPath);
}
}
function AddFlashLibrary($LibraryName, $LibraryPath)
{
if(!in_array($LibraryName, $this->__flashLibsArray))
{
$this->__hasFlashLibraries = true;
$this->__flashLibsArray[] = array($LibraryName, $LibraryPath);
}
}
function __FormatCustomInsertText()
{
// Private Function - This function will return all of the custom inserts as JavaScript arrays
if($this->__hasCustomInserts == true)
{
$ciText = "[";
for($i = 0; $i < sizeof($this->__customInsertArray); $i++)
{
$name = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customInsertArray[$i]["Name"]));
$html = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customInsertArray[$i]["HTML"]));
$ciText .= "[\"" . $name . "\", \"" . $html . "\"],";
}
$ciText = substr($ciText, 0, strlen($ciText)-1);
$ciText .= "]";
}
else
{
$ciText = "[]";
}
return $ciText;
}
// Added for v5.0
function __FormatCustomLinkText()
{
// Private Function - This function will return all of the custom links as JavaScript arrays
if($this->__hasCustomLinks == true)
{
$ciText = "[";
for($i = 0; $i < sizeof($this->__customLinkArray); $i++)
{
$name = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customLinkArray[$i]["Name"]));
$url = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customLinkArray[$i]["URL"]));
$target = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customLinkArray[$i]["Target"]));
$ciText .= "[\"" . $name . "\", \"" . $url . "\",\"" . $target . "\"],";
}
$ciText = substr($ciText, 0, strlen($ciText)-1);
$ciText .= "]";
}
else
{
$ciText = "[]";
}
return $ciText;
}
// Added for NX
function __FormatToolbarList()
{
if($this->__toolbarset == true)
{
$ciText = "[";
for($i = 0; $i < sizeof($this->__toolbarset); $i++)
{
$name = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customLinkArray[$i]["Name"]));
$url = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customLinkArray[$i]["URL"]));
$target = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__customLinkArray[$i]["Target"]));
$ciText .= "[\"" . $name . "\", \"" . $url . "\",\"" . $target . "\"],";
}
$ciText = substr($ciText, 0, strlen($ciText)-1);
$ciText .= "]";
}
else
{
$ciText = "[]";
}
return $ciText;
}
// Added for v5.0
function GetImageLibraries()
{
include_once(dirname(__FILE__).DIRECTORY_SEPARATOR."de_lang".DIRECTORY_SEPARATOR."language.php");
// Private Function - This function will return all of the image libraries as JavaScript arrays
$ciText = "";
if($this->__hasImageLibraries == true)
{
for($i = 0; $i < sizeof($this->__imageLibsArray); $i++)
{
$name = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__imageLibsArray[$i][0]));
$dir = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__imageLibsArray[$i][1]));
$ciText .= "";
}
}
return str_replace("'", "\'", $ciText);
}
function GetFlashLibraries()
{
include_once(dirname(__FILE__).DIRECTORY_SEPARATOR."de_lang".DIRECTORY_SEPARATOR."language.php");
// Private Function - This function will return all of the flash libraries as JavaScript arrays
$ciText = "";
if($this->__hasFlashLibraries == true)
{
for($i = 0; $i < sizeof($this->__flashLibsArray); $i++)
{
$name = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__flashLibsArray[$i][0]));
$dir = str_replace("\r\n", "\\r\\n", str_replace("\"", "\\\"", $this->__flashLibsArray[$i][1]));
$ciText .= "";
}
}
return str_replace("'", "\'", $ciText);
}
function SetSnippetStyleSheet($StyleSheetURL)
{
// Sets the location of the stylesheet for a code snippet
$this->__docType = DE_DOC_TYPE_SNIPPET;
$this->__snippetCSS = $StyleSheetURL;
}
function SetTextAreaDimensions($Cols, $Rows)
{
// Sets the rows and cols attributes of the