Modern API
Load richtexteditor/phphtmleditor/autoload.php and use the PhpHtmlEditor namespace. No Composer needed.
PhpHtmlEditor\Editor
| Member | Description |
|---|---|
new Editor($name) | The editor's name is its form field name. |
$html | The content to edit. |
$width, $height | CSS lengths; '100%' and '400px' by default. |
$toolbar | default, basic, full, mobile, office, or the name of a custom toolbar defined in $config. |
$config | Any option of the JavaScript editor, passed as-is: $editor->config['readOnly'] = true; |
$language | A file in richtexteditor/lang: 'de' loads rte-lang-de.js. The file manager and the server's messages (a refused upload, rename or delete) follow it in 12 languages (en, zh-Hans, zh-Hant, de, fr, es, it, pt, nl, ru, ja, ko); any of the file manager's texts can be replaced with $config['text_phpfiles_<key>']. |
$policyFile | The policy file in richtexteditor/config, or a full path. Choose it from your login system. |
$runtimeUrl | URL of the richtexteditor folder; detected when it is under the web root. |
$appRoot, $appUrl | What ~/ means in a policy (path and URL); the web root by default. |
handleRequest() | Answers this editor's upload, gallery and file requests and ends them. Call it before any output; it also starts the PHP session that protects them. |
render() | The editor's HTML for your form. |
posted() | The submitted HTML of this editor, sanitized with its policy. |
sanitize($html) | Sanitizes any HTML with this editor's policy. |
setSecurity($category, $storage, $name, $value) | Overrides one policy setting for this editor. |
policy() | The Policy object in use. |
Other classes
Policy::fromFile($path),get($category, $storage, $name),getBool(),getInt(),setSecurity(),storages($category): read a policy file.new Storage($policy, $category, $storage):listFolder(),upload(),createFolder(),rename(),delete(),permissions(), with every check of the policy applied. Use it to build your own file pages.new Sanitizer($policy)andsanitize($html): the server-side cleaning on its own.
Several editors
$summary = new Editor('Summary');
$body = new Editor('Body');
$summary->handleRequest();
$body->handleRequest();
// later: $summary->render(), $body->render(); $summary->posted(), $body->posted()