Xataface CKeditor Module 0.3
CKeditor Widget for Xataface
Public Member Functions | Data Fields
CKEditor Class Reference

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

Public Member Functions

 CKEditor ($basePath=null)
 editor ($name, $value="", $config=array(), $events=array())
 replace ($id, $config=array(), $events=array())
 replaceAll ($className=null)
 addEventHandler ($event, $javascriptCode)
 clearEventHandlers ($event=null)
 addGlobalEventHandler ($event, $javascriptCode)
 clearGlobalEventHandlers ($event=null)
 __construct ($basePath=null)
 editor ($name, $value="", $config=array(), $events=array())
 replace ($id, $config=array(), $events=array())
 replaceAll ($className=null)
 addEventHandler ($event, $javascriptCode)
 clearEventHandlers ($event=null)
 addGlobalEventHandler ($event, $javascriptCode)
 clearGlobalEventHandlers ($event=null)

Data Fields

 $basePath
 $config = array()
 $initialized = false
 $returnOutput = false
 $textareaAttributes = array( "rows" => 8, "cols" => 60 )
 $timestamp = "A8LE4JO"
const version = '3.4.1'
const timestamp = 'A8LE4JO'

Detailed Description

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

See also:
http://ckeditor.com

Sample usage:

 $CKEditor = new CKEditor();
 $CKEditor->editor("editor1", "<p>Initial value.</p>");

Definition at line 18 of file ckeditor_php4.php.


Constructor & Destructor Documentation

__construct ( basePath = null)

Main Constructor.

Parameters:
$basePath(string) URL to the CKEditor installation directory (optional).

Definition at line 96 of file ckeditor_php5.php.


Member Function Documentation

addEventHandler ( event,
javascriptCode 
)

Adds event listener. Events are fired by CKEditor in various situations.

Parameters:
$event(string) Event name.
$javascriptCode(string) Javascript anonymous function or function name.

Example usage:

 $CKEditor->addEventHandler('instanceReady', 'function (ev) {
     alert("Loaded: " + ev.editor.name);
 }');

Definition at line 275 of file ckeditor_php4.php.

addEventHandler ( event,
javascriptCode 
)

Adds event listener. Events are fired by CKEditor in various situations.

Parameters:
$event(string) Event name.
$javascriptCode(string) Javascript anonymous function or function name.

Example usage:

 $CKEditor->addEventHandler('instanceReady', 'function (ev) {
     alert("Loaded: " + ev.editor.name);
 }');

Definition at line 271 of file ckeditor_php5.php.

addGlobalEventHandler ( event,
javascriptCode 
)

Adds global event listener.

Parameters:
$event(string) Event name.
$javascriptCode(string) Javascript anonymous function or function name.

Example usage:

 $CKEditor->addGlobalEventHandler('dialogDefinition', 'function (ev) {
     alert("Loading dialog: " + ev.data.name);
 }');

Definition at line 315 of file ckeditor_php4.php.

addGlobalEventHandler ( event,
javascriptCode 
)

Adds global event listener.

Parameters:
$event(string) Event name.
$javascriptCode(string) Javascript anonymous function or function name.

Example usage:

 $CKEditor->addGlobalEventHandler('dialogDefinition', 'function (ev) {
     alert("Loading dialog: " + ev.data.name);
 }');

Definition at line 311 of file ckeditor_php5.php.

CKEditor ( basePath = null)

Main Constructor.

Parameters:
$basePath(string) URL to the CKEditor installation directory (optional).

Definition at line 100 of file ckeditor_php4.php.

clearEventHandlers ( event = null)

Clear registered event handlers. Note: this function will have no effect on already created editor instances.

Parameters:
$event(string) Event name, if not set all event handlers will be removed (optional).

Definition at line 288 of file ckeditor_php5.php.

clearEventHandlers ( event = null)

Clear registered event handlers. Note: this function will have no effect on already created editor instances.

Parameters:
$event(string) Event name, if not set all event handlers will be removed (optional).

Definition at line 292 of file ckeditor_php4.php.

clearGlobalEventHandlers ( event = null)

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

Parameters:
$event(string) Event name, if not set all event handlers will be removed (optional).

Definition at line 332 of file ckeditor_php4.php.

clearGlobalEventHandlers ( event = null)

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

Parameters:
$event(string) Event name, if not set all event handlers will be removed (optional).

Definition at line 328 of file ckeditor_php5.php.

editor ( name,
value = "",
config = array(),
events = array() 
)

Creates a CKEditor instance. In incompatible browsers CKEditor will downgrade to plain HTML <textarea> element.

Parameters:
$name(string) Name of the CKEditor instance (this will be also the "name" attribute of textarea element).
$value(string) Initial value (optional).
$config(array) The specific configurations to apply to this editor instance (optional).
$events(array) Event listeners for this editor instance (optional).

Example usage:

 $CKEditor = new CKEditor();
 $CKEditor->editor("field1", "<p>Initial value.</p>");

Advanced example:

 $CKEditor = new CKEditor();
 $config = array();
 $config['toolbar'] = array(
     array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
     array( 'Image', 'Link', 'Unlink', 'Anchor' )
 );
 $events['instanceReady'] = 'function (ev) {
     alert("Loaded: " + ev.editor.name);
 }';
 $CKEditor->editor("field1", "<p>Initial value.</p>", $config, $events);

Definition at line 131 of file ckeditor_php5.php.

editor ( name,
value = "",
config = array(),
events = array() 
)

Creates a CKEditor instance. In incompatible browsers CKEditor will downgrade to plain HTML <textarea> element.

Parameters:
$name(string) Name of the CKEditor instance (this will be also the "name" attribute of textarea element).
$value(string) Initial value (optional).
$config(array) The specific configurations to apply to this editor instance (optional).
$events(array) Event listeners for this editor instance (optional).

Example usage:

 $CKEditor = new CKEditor();
 $CKEditor->editor("field1", "<p>Initial value.</p>");

Advanced example:

 $CKEditor = new CKEditor();
 $config = array();
 $config['toolbar'] = array(
     array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
     array( 'Image', 'Link', 'Unlink', 'Anchor' )
 );
 $events['instanceReady'] = 'function (ev) {
     alert("Loaded: " + ev.editor.name);
 }';
 $CKEditor->editor("field1", "<p>Initial value.</p>", $config, $events);

Definition at line 135 of file ckeditor_php4.php.

replace ( id,
config = array(),
events = array() 
)

Replaces a <textarea> with a CKEditor instance.

Parameters:
$id(string) The id or name of textarea element.
$config(array) The specific configurations to apply to this editor instance (optional).
$events(array) Event listeners for this editor instance (optional).

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

 $CKEditor = new CKEditor();
 $CKEditor->replace("article");

Definition at line 177 of file ckeditor_php4.php.

replace ( id,
config = array(),
events = array() 
)

Replaces a <textarea> with a CKEditor instance.

Parameters:
$id(string) The id or name of textarea element.
$config(array) The specific configurations to apply to this editor instance (optional).
$events(array) Event listeners for this editor instance (optional).

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

 $CKEditor = new CKEditor();
 $CKEditor->replace("article");

Definition at line 173 of file ckeditor_php5.php.

replaceAll ( className = null)

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

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

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

 $CKEditor = new CKEditor();
 $CKEditor->replaceAll();

Example 2: replace all <textarea class="myClassName"> elements in the page.

 $CKEditor = new CKEditor();
 $CKEditor->replaceAll( 'myClassName' );

Definition at line 220 of file ckeditor_php4.php.

replaceAll ( className = null)

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

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

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

 $CKEditor = new CKEditor();
 $CKEditor->replaceAll();

Example 2: replace all <textarea class="myClassName"> elements in the page.

 $CKEditor = new CKEditor();
 $CKEditor->replaceAll( 'myClassName' );

Definition at line 216 of file ckeditor_php5.php.


Field Documentation

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:

 $CKEditor->basePath = '/ckeditor/';

Definition at line 40 of file ckeditor_php4.php.

$config = array()

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:

 $CKEditor->config['height'] = 400;
 // Use @@ at the beggining of a string to ouput it without surrounding quotes.
 $CKEditor->config['width'] = '@@screen.width * 0.8';

Definition at line 52 of file ckeditor_php4.php.

$initialized = false

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.

Definition at line 58 of file ckeditor_php4.php.

$returnOutput = false

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.

 $CKEditor = new CKEditor();
 $CKEditor->returnOutput = true;
 $code = $CKEditor->editor("editor1", "<p>Initial value.</p>");
 echo "<p>Editor 1:</p>";
 echo $code;

Definition at line 71 of file ckeditor_php4.php.

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

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.

Definition at line 78 of file ckeditor_php4.php.

$timestamp = "A8LE4JO"

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.

Definition at line 83 of file ckeditor_php4.php.

const timestamp = 'A8LE4JO'

A constant string unique for each release of CKEditor.

Definition at line 27 of file ckeditor_php5.php.

const version = '3.4.1'

The version of CKEditor.

Definition at line 23 of file ckeditor_php5.php.


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables