Class CKEditor

Description

\brief CKEditor class that can be used to create editor instances in PHP pages on server side.

Located in /template/Backend/js/ckeditor/ckeditor_php4.php (line 18)


        
                    
Variable Summary
Method Summary
 CKEditor ([$basePath $basePath = null]) CKEditor
 addEventHandler ($event $event, $javascriptCode $javascriptCode) void
 addGlobalEventHandler ($event $event, $javascriptCode $javascriptCode) void
 ckeditorPath () void
 clearEventHandlers ([$event $event = null]) void
 clearGlobalEventHandlers ([$event $event = null]) void
 configSettings ([$config $config = array()], [$events $events = array()]) void
 editor ($name $name, [$value $value = ""], [$config $config = array()], [$events $events = array()]) void
 init () void
 jsEncode (mixed $val) string
 replace ($id $id, [$config $config = array()], [$events $events = array()]) void
 replaceAll ([$className $className = null]) void
 script (string $js) void
Variables
mixed $basePath (line 40)

URL to the %CKEditor installation directory (absolute or relative to document root).

If not set, CKEditor will try to guess it's path.

Example usage:

mixed $config = array() (line 52)

An array that holds the global %CKEditor configuration.

For the list of available options, see http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html

Example usage:

mixed $initialized = false (line 58)

A boolean variable indicating whether CKEditor has been initialized.

Set it to true only if you have already included <script> tag loading ckeditor.js in your website.

mixed $returnOutput = false (line 71)

Boolean variable indicating whether created code should be printed out or returned by a function.

Example 1: get the code creating %CKEditor instance and print it on a page with the "echo" function.

mixed $textareaAttributes = array( "rows" => 8, "cols" => 60 ) (line 78)

An array with textarea attributes.

When %CKEditor is created with the editor() method, a HTML <textarea> element is created, it will be displayed to anyone with JavaScript disabled or with incompatible browser.

mixed $timestamp = "B8DJ5M3" (line 83)

A string indicating the creation date of %CKEditor.

Do not change it unless you want to force browsers to not use previously cached version of %CKEditor.

mixed $version = '3.6.2' (line 24)

The version of %CKEditor.

\private

mixed $_events = array() (line 88)

An array that holds event listeners.

\private

mixed $_globalEvents = array() (line 93)

An array that holds global event listeners.

\private

mixed $_timestamp = 'B8DJ5M3' (line 29)

A constant string unique for each release of %CKEditor.

\private

Methods
Constructor CKEditor (line 100)

Main Constructor.

CKEditor CKEditor ([$basePath $basePath = null])
  • $basePath $basePath: (string) URL to the %CKEditor installation directory (optional).
addEventHandler (line 275)

Adds event listener.

Events are fired by %CKEditor in various situations.

void addEventHandler ($event $event, $javascriptCode $javascriptCode)
  • $event $event: (string) Event name.
  • $javascriptCode $javascriptCode:

    (string) Javascript anonymous function or function name.

    Example usage:

addGlobalEventHandler (line 315)

Adds global event listener.

void addGlobalEventHandler ($event $event, $javascriptCode $javascriptCode)
  • $event $event: (string) Event name.
  • $javascriptCode $javascriptCode:

    (string) Javascript anonymous function or function name.

    Example usage:

ckeditorPath (line 487)

Return path to ckeditor.js.

\private

void ckeditorPath ()
clearEventHandlers (line 292)

Clear registered event handlers.

Note: this function will have no effect on already created editor instances.

void clearEventHandlers ([$event $event = null])
  • $event $event: (string) Event name, if not set all event handlers will be removed (optional).
clearGlobalEventHandlers (line 332)

Clear registered global event handlers.

Note: this function will have no effect if the event handler has been already printed/returned.

void clearGlobalEventHandlers ([$event $event = null])
  • $event $event: (string) Event name, if not set all event handlers will be removed (optional).
configSettings (line 366)

Returns the configuration array (global and instance specific settings are merged into one array).

\private

void configSettings ([$config $config = array()], [$events $events = array()])
  • $config $config: (array) The specific configurations to apply to editor instance.
  • $events $events: (array) Event listeners for editor instance.
editor (line 135)

Creates a %CKEditor instance.

In incompatible browsers %CKEditor will downgrade to plain HTML <textarea> element.

void editor ($name $name, [$value $value = ""], [$config $config = array()], [$events $events = array()])
  • $name $name: (string) Name of the %CKEditor instance (this will be also the "name" attribute of textarea element).
  • $value $value: (string) Initial value (optional).
  • $config $config: (array) The specific configurations to apply to this editor instance (optional).
  • $events $events:

    (array) Event listeners for this editor instance (optional).

    Example usage:

init (line 442)

Initializes CKEditor (executed only once).

\private

void init ()
jsEncode (line 534)

This little function provides a basic JSON support.

\private

string jsEncode (mixed $val)
  • mixed $val
replace (line 177)

Replaces a <textarea> with a %CKEditor instance.

void replace ($id $id, [$config $config = array()], [$events $events = array()])
  • $id $id: (string) The id or name of textarea element.
  • $config $config: (array) The specific configurations to apply to this editor instance (optional).
  • $events $events:

    (array) Event listeners for this editor instance (optional).

    Example 1: adding %CKEditor to <textarea name="article"></textarea> element:

replaceAll (line 220)

Replace all <textarea> elements available in the document with editor instances.

void replaceAll ([$className $className = null])
  • $className $className:

    (string) If set, replace all textareas with class className in the page.

    Example 1: replace all <textarea> elements in the page.

returnGlobalEvents (line 411)

Return global event handlers.

\private

void returnGlobalEvents ()
script (line 348)

Prints javascript code.

\private

void script (string $js)
  • string $js