36 if ( isset( $_SERVER ) ) {
37 $sAgent = $_SERVER[
'HTTP_USER_AGENT'] ;
40 global $HTTP_SERVER_VARS ;
41 if ( isset( $HTTP_SERVER_VARS ) ) {
42 $sAgent = $HTTP_SERVER_VARS[
'HTTP_USER_AGENT'] ;
45 global $HTTP_USER_AGENT ;
46 $sAgent = $HTTP_USER_AGENT ;
50 if ( strpos($sAgent,
'MSIE') !==
false && strpos($sAgent,
'mac') ===
false && strpos($sAgent,
'Opera') ===
false )
52 $iVersion = (float)substr($sAgent, strpos($sAgent,
'MSIE') + 5, 3) ;
53 return ($iVersion >= 5.5) ;
55 else if ( strpos($sAgent,
'Gecko/') !== false )
58 if (preg_match(
"|Gecko/\d+\.\d+|", $sAgent))
60 $iVersion = (int)substr($sAgent, strpos($sAgent,
'Gecko/') + 6, 8) ;
61 return ($iVersion >= 20030210) ;
63 else if ( strpos($sAgent,
'Opera/') !== false )
65 $fVersion = (float)substr($sAgent, strpos($sAgent,
'Opera/') + 6, 4) ;
66 return ($fVersion >= 9.5) ;
68 else if ( preg_match(
"|AppleWebKit/(\d+)|i", $sAgent, $matches ) )
70 $iVersion = $matches[1] ;
71 return ( $matches[1] >= 522 ) ;
135 $this->InstanceName = $instanceName ;
136 $this->BasePath =
'/fckeditor/' ;
137 $this->Width =
'100%' ;
138 $this->Height =
'200' ;
139 $this->ToolbarSet =
'Default' ;
142 $this->Config = array() ;
161 $HtmlValue = htmlspecialchars( $this->Value ) ;
165 if ( !isset( $_GET ) ) {
166 global $HTTP_GET_VARS ;
167 $_GET = $HTTP_GET_VARS ;
172 if ( isset( $_GET[
'fcksource'] ) && $_GET[
'fcksource'] ==
"true" )
173 $File =
'fckeditor.original.html' ;
175 $File =
'fckeditor.html' ;
177 $Link =
"{$this->BasePath}editor/{$File}?InstanceName={$this->InstanceName}" ;
179 if ( $this->ToolbarSet !=
'' )
180 $Link .=
"&Toolbar={$this->ToolbarSet}" ;
183 $Html .=
"<input type=\"hidden\" id=\"{$this->InstanceName}\" name=\"{$this->InstanceName}\" value=\"{$HtmlValue}\" style=\"display:none\" />" ;
186 $Html .=
"<input type=\"hidden\" id=\"{$this->InstanceName}___Config\" value=\"" . $this->
GetConfigFieldString() .
"\" style=\"display:none\" />" ;
189 $Html .=
"<iframe id=\"{$this->InstanceName}___Frame\" src=\"{$Link}\" width=\"{$this->Width}\" height=\"{$this->Height}\" frameborder=\"0\" scrolling=\"no\"></iframe>" ;
193 if ( strpos( $this->Width,
'%' ) ===
false )
194 $WidthCSS = $this->Width .
'px' ;
198 if ( strpos( $this->Height,
'%' ) ===
false )
199 $HeightCSS = $this->Height .
'px' ;
203 $Html .=
"<textarea name=\"{$this->InstanceName}\" rows=\"4\" cols=\"40\" style=\"width: {$WidthCSS}; height: {$HeightCSS}\">{$HtmlValue}</textarea>" ;
230 foreach ( $this->Config as $sKey => $sValue )
232 if ( $bFirst ==
false )
233 $sParams .=
'&' ;
237 if ( $sValue ===
true )
239 else if ( $sValue ===
false )
263 return strtr( $valueToEncode, $chars ) ;
EncodeConfig($valueToEncode)
Encode characters that may break the configuration string generated by GetConfigFieldString().
FCKeditor_IsCompatibleBrowser()
Check if browser is compatible with FCKeditor.
GetConfigFieldString()
Get settings from Config array as a single string.
IsCompatible()
Returns true if browser is compatible with FCKeditor.
FCKeditor($instanceName)
Main Constructor.
Create()
Display FCKeditor.
CreateHtml()
Return the HTML code required to run FCKeditor.