|
static | apply ($markup, $text, $trim) |
|
static | editorEnabled () |
|
static | isHtml ($text) |
|
static | isHtmlFallback ($text) |
|
static | hasHtmlMarker ($text) |
|
static | markAsHtml ($text) |
|
static | purifyHtml ($html) |
|
static | htmlReady ( $text, $trim=true, $br=false, $double_encode=true) |
|
static | wysiwygReady ( $text, $trim=true, $br=false, $double_encode=true) |
|
static | markupToHtml ($text, $trim=true, $mark=true) |
|
static | removeHtml ($html) |
|
◆ apply()
static apply |
( |
|
$markup, |
|
|
|
$text, |
|
|
|
$trim |
|
) |
| |
|
static |
Apply markup rules and clean the text up.
- Parameters
-
TextFormat | $markup | Markup rules applied on marked-up text. |
string | $text | Marked-up text on which rules are applied. |
boolean | $trim | Trim text before applying markup rules, if TRUE. |
- Returns
- string HTML code computed from marked-up text.
◆ editorEnabled()
Return true
if the WYSIWYG editor is enabled for this user.
- Returns
- boolean always returns
true
.
◆ hasHtmlMarker()
static hasHtmlMarker |
( |
|
$text | ) |
|
|
static |
Return true
for HTML code and false
for plain text.
HTML code must start with a match for HTML_MARKER_REGEXP
.
- Parameters
-
string | $text | HTML code or plain text. |
- Returns
- boolean
true
for HTML code, false
for plain text.
◆ htmlReady()
static htmlReady |
( |
|
$text, |
|
|
|
$trim = true , |
|
|
|
$br = false , |
|
|
|
$double_encode = true |
|
) |
| |
|
static |
Convert special characters to HTML entities, and clean up.
- Parameters
-
string | $text | This text's special chars will be converted. |
boolean | $trim | Trim text before applying markup rules, if TRUE. |
boolean | $br | Replace newlines by
, if TRUE. |
boolean | $double_encode | Encode existing HTML entities, if TRUE. |
- Returns
- string The converted string.
◆ isHtml()
Return true
for HTML code and false
for plain text.
HTML code must either match HTML_MARKER_REGEXP
or begin with '<' and end with '>' (leading and trailing whitespace is ignored). Everything else is considered to be plain text.
- Parameters
-
string | $text | HTML code or plain text. |
- Returns
- boolean
true
for HTML code, false
for plain text.
◆ isHtmlFallback()
static isHtmlFallback |
( |
|
$text | ) |
|
|
static |
Return true
for Stud.IP-HTML and false
otherwise.
Stud.IP-HTML is HTML that can contain Stud.IP Markup.
Stud.IP-HTML must match Stud.IP 3.2's HTML marker. Leading and trailing whitespace is ignored.
Everything else is considered not Stud.IP-HTML. In other words, if it's not Stud.IP-HTML it might be everything from plain text to binary code. But usually it's either Stud.IP markup or plain HTML code, then.
- Parameters
-
string | $text | Text that is or isn't Stud.IP-HTML. |
- Returns
- boolean
true
for Stud.IP-HTML
◆ markAsHtml()
static markAsHtml |
( |
|
$text | ) |
|
|
static |
Mark a given text as HTML code.
No sanity-checking is done on the given text. It is simply marked up so to be identified by Markup::isHtml as HTML code.
- Parameters
-
string | $text | The text to be marked up as HTML code. |
- Returns
- string The text marked up as HTML code.
◆ markupToHtml()
static markupToHtml |
( |
|
$text, |
|
|
|
$trim = true , |
|
|
|
$mark = true |
|
) |
| |
|
static |
Convert Stud.IP markup (possibly mixed with HTML if fallback mode is enabled) to editable HTML. Pure HTML will only run through the purifier.
- Parameters
-
string | $text | The text. |
boolean | $trim | Trim text before applying markup rules, if TRUE. |
boolean | $mark | Mark result text as HTML, if TRUE. |
- Returns
- string The converted string.
◆ purifyHtml()
static purifyHtml |
( |
|
$html | ) |
|
|
static |
Call HTMLPurifier to filter the HTML code (if the source is detected to contain HTML, returns the argument unchanged otherwise). The HTML marker is restored afterwards, if it was present.
- Parameters
-
string | $dirty_html | Unsafe or 'uncleaned' HTML code. |
- Returns
- string Clean and safe HTML code.
◆ removeHtml()
static removeHtml |
( |
|
$html | ) |
|
|
static |
Call HTMLPurifier to remove all HTML tags from the string (if the source is detected to contain HTML, returns the argument unchanged otherwise).
- Parameters
-
string | $html | HTML code to filter |
- Returns
- string The converted string.
◆ wysiwygReady()
static wysiwygReady |
( |
|
$text, |
|
|
|
$trim = true , |
|
|
|
$br = false , |
|
|
|
$double_encode = true |
|
) |
| |
|
static |
Prepare text for wysiwyg (if enabled), otherwise convert special characters using htmlReady.
- Parameters
-
string | $text | The text. |
boolean | $trim | Trim text before applying markup rules, if TRUE. |
boolean | $br | Replace newlines by
, if TRUE and wysiwyg editor disabled. |
boolean | $double_encode | Encode existing HTML entities, if TRUE and wysiwyg editor disabled. |
- Returns
- string The converted string.
◆ HTML_MARKER
const HTML_MARKER = '<!--HTML-->' |
◆ HTML_MARKER_FALLBACK
const HTML_MARKER_FALLBACK = '<!-- HTML: Insert text after this line only. -->' |
◆ HTML_MARKER_REGEXP
const HTML_MARKER_REGEXP = '/^\s*<!--\s*HTML.*?-->/i' |
The documentation for this class was generated from the following file: