Stud.IP  jlu_3.3 Revision
Markup Class Reference
Collaboration diagram for Markup:
Collaboration graph

Static Public Member Functions

static apply ($markup, $text, $trim)
 
static isHtml ($text)
 
static hasHtmlMarker ($text)
 
static markAsHtml ($text)
 
static purify ($dirty_html)
 
static htmlReady ( $text, $trim=true, $br=false, $double_encode=true)
 
static removeHTML ($html)
 

Data Fields

const HTML_MARKER
 
const HTML_MARKER_REGEXP
 

Detailed Description

Member Function Documentation

◆ apply()

static apply (   $markup,
  $text,
  $trim 
)
static

Apply markup rules and clean the text up.

Parameters
TextFormat$markupMarkup rules applied on marked-up text.
string$textMarked-up text on which rules are applied.
boolean$trimTrim text before applying markup rules, if TRUE.
Returns
string HTML code computed from marked-up text.

◆ hasHtmlMarker()

static hasHtmlMarker (   $text)
static

◆ htmlReady()

static htmlReady (   $text,
  $trim = true,
  $br = false,
  $double_encode = true 
)
static

Convert special characters to HTML entities, and clean up.

Parameters
string$textThis text's special chars will be converted.
boolean$trimTrim text before applying markup rules, if TRUE.
boolean$brReplace newlines by
, if TRUE.
boolean$double_encodeEncode existing HTML entities, if TRUE.
Returns
string The converted string.

◆ isHtml()

static isHtml (   $text)
static

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$textHTML code or plain text.
Returns
boolean true for HTML code, false for plain text.

◆ 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$textThe text to be marked up as HTML code.
Returns
string The text marked up as HTML code.

◆ purify()

static purify (   $dirty_html)
static

Call HTMLPurifier to create safe HTML.

Parameters
string$dirty_htmlUnsafe or 'uncleaned' HTML code.
Returns
string Clean and safe HTML code.
Here is the call graph for this function:

◆ removeHTML()

static removeHTML (   $html)
static

Field Documentation

◆ HTML_MARKER

const HTML_MARKER
Initial value:
=
'<!-- HTML: Insert text after this line only. -->'

◆ HTML_MARKER_REGEXP

const HTML_MARKER_REGEXP
Initial value:
=
'^[\s\n]*<!--[\s\n]*[Hh][Tt][Mm][Ll][^->]*-->'

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