Luminous git-master

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

All Classes Files Functions Variables
Static Public Member Functions | List of all members
LuminousUtils Class Reference

A set of utility functions for scanners. More...

## Static Public Member Functions

static | balance_delimiter ($delimiter)
| Tries to balance a delimiter.
static | escape_string ($string)
| Escapes a string suitable for use in XML.
static | escape_token ($token)
| Escapes a token so its string is suitable for use in XML.
static | pcre_error_decode ($errcode)
| Decodes PCRE error codes to human readable strings.
static | tag_block ($type, $block, $split_multiline=true)
| Wraps a block of text in an XML tag.

## Detailed Description

A set of utility functions for scanners.

## Member Function Documentation

static LuminousUtils::balance_delimiter | ( |  | $delimiter | ) |

static

Tries to balance a delimiter.

Tries to 'balance' a single character delimiter, i.e: '(' is mapped to ')' '{' is mapped to '}', '[' is mapped to ']', '<' is mapped to '>' Any other character is mapped to itself.

Parameters

  $delimiter | the left/opening delimiter to try to balance

Returns
  The corresponding close delimiter character, or the input character.

static LuminousUtils::escape_string | ( |  | $string | ) |

static

Escapes a string suitable for use in XML.

Escapes a string according to the Luminous internal escaping format (this is currently htmlspecialchars with ENT_NOQUOTES.)

Parameters

  $string | the string to escape

Returns
  the escaped string

static LuminousUtils::escape_token | ( |  | $token | ) |

static

Escapes a token so its string is suitable for use in XML.

Escapes a token. If the token is already escaped, nothing changes. If the token is not escaped, the escaped flag is set (index 2) and the token text (index 1) is escaped according to the internal escaping format

Parameters

  $token | the token to escape

Returns
  the escaped token

static LuminousUtils::pcre_error_decode | ( |  | $errcode | ) |

static

Decodes PCRE error codes to human readable strings.

Decodes a PCRE error code, which was returned by preg_last_error(), to something readable

Parameters

  $errcode | the error code

Returns
  the error description, as string. This is currently the same as the constant name, so the constant PREG_NO_ERROR is mapped to the string 'PREG_NO_ERROR'

static LuminousUtils::tag_block | ( |  | $type,
|  |  | $block,
|  |  | $split_multiline = `true`
| ) |  |

static

Wraps a block of text in an XML tag.

Tags a block of text. The block is assumed to have been escaped correctly with LuminousUtils::escape_string.

Parameters

  $type | the type to tag the string as, this is the token name
  $block | the block of text
  $split_multiline | if this is set to true, the tags are closed at the end of each line and re-opened again on the next line. This is useful for output formats like HTML, where spanning multiple lines could break the markup

Returns
  The tagged block of text. This resembles an XML fragment.

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

- src/core/utils.class.php