PEEL Shopping
Open source ecommerce : PEEL Shopping
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

 __construct ($basePath=null)
 Main Constructor. More...
 
 editor ($name, $value="", $config=array(), $events=array())
 Creates a CKEditor instance. More...
 
 replace ($id, $config=array(), $events=array())
 Replaces a <textarea> with a CKEditor instance. More...
 
 replaceAll ($className=null)
 Replace all <textarea> elements available in the document with editor instances. More...
 
 addEventHandler ($event, $javascriptCode)
 Adds event listener. More...
 
 clearEventHandlers ($event=null)
 Clear registered event handlers. More...
 
 addGlobalEventHandler ($event, $javascriptCode)
 Adds global event listener. More...
 
 clearGlobalEventHandlers ($event=null)
 Clear registered global event handlers. More...
 

Data Fields

const version = '3.6.5'
 The version of CKEditor. More...
 
const timestamp = 'C9A85WF'
 A constant string unique for each release of CKEditor. More...
 
 $basePath
 URL to the CKEditor installation directory (absolute or relative to document root). More...
 
 $config = array()
 An array that holds the global CKEditor configuration. More...
 
 $initialized = false
 A boolean variable indicating whether CKEditor has been initialized. More...
 
 $returnOutput = false
 Boolean variable indicating whether created code should be printed out or returned by a function. More...
 
 $textareaAttributes = array( "rows" => 8, "cols" => 60 )
 An array with textarea attributes. More...
 
 $timestamp = "C9A85WF"
 A string indicating the creation date of CKEditor. More...
 

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_php5.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 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 311 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 288 of file ckeditor_php5.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.

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 216 of file ckeditor_php5.php.

Field Documentation

$basePath

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 38 of file ckeditor_php5.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 50 of file ckeditor_php5.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 56 of file ckeditor_php5.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 69 of file ckeditor_php5.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 76 of file ckeditor_php5.php.

$timestamp = "C9A85WF"

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 81 of file ckeditor_php5.php.

const timestamp = 'C9A85WF'

A constant string unique for each release of CKEditor.

Definition at line 27 of file ckeditor_php5.php.

const version = '3.6.5'

The version of CKEditor.

Definition at line 23 of file ckeditor_php5.php.


The documentation for this class was generated from the following file:

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:43 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.