Editor
in package
implements
ArrayAccess
Uses
BackwardCompatibility, ArrayAccessHelper
Creates the editor input box so that people can write messages to post.
Table of Contents
Interfaces
- ArrayAccess
Constants
- PREVIEW_HTML = 1
- PREVIEW_XML = 2
Properties
- $bbc_handlers : string
- $bbc_tags : array<string|int, mixed>
- $bbc_toolbar : array<string|int, mixed>
- $columns : string
- $disable_smiley_box : string
- $disabled_tags : array<string|int, mixed>
- $form : string
- $height : string
- $id : string
- $labels : array<string|int, mixed>
- $loaded : array<string|int, mixed>
- $locale : string
- $preview_type : int
- $required : bool
- $rich_active : string
- $rows : string
- $sce_options : array<string|int, mixed>
- $smileys_toolbar : array<string|int, mixed>
- $value : string
- $width : string
- $prop_aliases : array<string|int, mixed>
- $backcompat : array<string|int, mixed>
Methods
- __construct() : mixed
- Constructor.
- exportStatic() : void
- Provides a way to export a class's public static properties and methods to global namespace.
- getMessageIcons() : array<string|int, mixed>
- Retrieves a list of message icons.
- load() : object
- Static wrapper for constructor.
- offsetExists() : bool
- Checks whether a property has been set when object is accessed as an array.
- offsetGet() : mixed
- Gets properties when object is accessed as an array.
- offsetSet() : void
- Sets properties when object is accessed as an array.
- offsetUnset() : void
- Unsets properties when object is accessed as an array.
- buildBbcToolbar() : void
- Initialize the BBC button toolbar, if not already loaded.
- buildButtons() : void
- Builds the main editor form buttons (submit, preview, etc.)
- buildSmileysToolbar() : void
- Initialize the smiley toolbar, if enabled and not already loaded.
- init() : void
- Initializes some required template stuff.
- setSCEditorOptions() : mixed
- Initialize the smiley toolbar, if enabled and not already loaded.
Constants
PREVIEW_HTML
public
mixed
PREVIEW_HTML
= 1
PREVIEW_XML
public
mixed
PREVIEW_XML
= 2
Properties
$bbc_handlers
public
static string
$bbc_handlers
= ''
$bbc_tags
public
static array<string|int, mixed>
$bbc_tags
= []
$bbc_toolbar
public
static array<string|int, mixed>
$bbc_toolbar
= []
$columns
public
string
$columns
Column width of the editor's input area.
$disable_smiley_box
public
string
$disable_smiley_box
Whether to show the smiley box.
$disabled_tags
public
static array<string|int, mixed>
$disabled_tags
= []
$form
public
string
$form
ID of the HTML form for this editor.
$height
public
string
$height
CSS height of the editor's input area.
$id
public
string
$id
This editor's ID string.
$labels
public
array<string|int, mixed>
$labels
Labels for the form's main buttons.
$loaded
public
static array<string|int, mixed>
$loaded
= []
All loaded instances of this class.
$locale
public
string
$locale
The locale to use for the input form.
$preview_type
public
int
$preview_type
Which type of previews we want.
Value must be one of this class's PREVIEW_* constants.
$required
public
bool
$required
Whether input is required (i.e. submitted value cannot be empty).
$rich_active
public
string
$rich_active
Whether WYSIWYG mode is initially on or off.
$rows
public
string
$rows
Row height of the editor's input area.
$sce_options
public
array<string|int, mixed>
$sce_options
= []
Options to pass to SCEditor.
$smileys_toolbar
public
static array<string|int, mixed>
$smileys_toolbar
= ['postform' => [], 'popup' => []]
$value
public
string
$value
This editor's value.
$width
public
string
$width
CSS width of the editor's input area.
$prop_aliases
protected
array<string|int, mixed>
$prop_aliases
= ['rich_value' => 'value']
Alternate names for some object properties.
$backcompat
private
static array<string|int, mixed>
$backcompat
= ['func_names' => ['load' => 'create_control_richedit', 'getMessageIcons' => 'getMessageIcons']]
BackwardCompatibility settings for this class.
Methods
__construct()
Constructor.
public
__construct(array<string|int, mixed> $options) : mixed
Parameters
- $options : array<string|int, mixed>
-
Various options for the editor.
exportStatic()
Provides a way to export a class's public static properties and methods to global namespace.
public
static exportStatic() : void
To do so:
- Use this trait in the class.
- At the END of the class's file, call its exportStatic() method.
Although it might not seem that way at first glance, this approach conforms to section 2.3 of PSR 1, since executing this method is simply a dynamic means of declaring functions when the file is included; it has no other side effects.
Regarding the $backcompat items:
A class's static properties are not exported to global variables unless explicitly included in $backcompat['prop_names']. Likewise, a class's static methods are not exported as global functions unless explicitly included in $backcompat['func_names'].
$backcompat['prop_names'] is a simple array where the keys are the names of one or more of a class's static properties, and the values are the names of global variables. In each case, the global variable will be set to a reference to the static property. Static properties that are not named in this array will not be exported.
$backcompat['func_names'] is a simple array where the keys are the names of one or more of a class's static methods, and the values are the names that should be used for global functions that will encapsulate those methods. Methods that are not named in this array will not be exported.
Adding non-static properties or methods to the $backcompat arrays will produce runtime errors. It is the responsibility of the developer to make sure not to do this.
getMessageIcons()
Retrieves a list of message icons.
public
static getMessageIcons(int $board_id) : array<string|int, mixed>
Based on the settings, the array will either contain a list of default message icons or a list of custom message icons retrieved from the database.
The board_id is needed for the custom message icons (which can be set for each board individually).
Parameters
- $board_id : int
-
The ID of the board
Return values
array<string|int, mixed> —An array of info about available icons
load()
Static wrapper for constructor.
public
static load(array<string|int, mixed> $options) : object
Parameters
- $options : array<string|int, mixed>
-
Various options for the editor.
Return values
object —An instance of this class.
offsetExists()
Checks whether a property has been set when object is accessed as an array.
public
offsetExists(mixed $prop) : bool
Parameters
- $prop : mixed
-
The property name.
Return values
booloffsetGet()
Gets properties when object is accessed as an array.
public
offsetGet(mixed $prop) : mixed
Parameters
- $prop : mixed
-
The property name.
offsetSet()
Sets properties when object is accessed as an array.
public
offsetSet(mixed $prop, mixed $value) : void
Parameters
- $prop : mixed
-
The property name.
- $value : mixed
-
The value to set.
offsetUnset()
Unsets properties when object is accessed as an array.
public
offsetUnset(mixed $prop) : void
Parameters
- $prop : mixed
-
The property name.
buildBbcToolbar()
Initialize the BBC button toolbar, if not already loaded.
protected
buildBbcToolbar() : void
buildButtons()
Builds the main editor form buttons (submit, preview, etc.)
protected
buildButtons() : void
buildSmileysToolbar()
Initialize the smiley toolbar, if enabled and not already loaded.
protected
buildSmileysToolbar() : void
init()
Initializes some required template stuff.
protected
init() : void
Only acts the first time an instance of this class is created.
setSCEditorOptions()
Initialize the smiley toolbar, if enabled and not already loaded.
protected
setSCEditorOptions() : mixed