PHP Class Golonka\BBCode\BBCodeParser

Datei anzeigen Open project: golonka/bbcodeparser Class Usage Examples

Public Properties

Property Type Description
$parsers

Public Methods

Method Description
__construct ( )
except ( mixed $except = null ) : object Removes the parsers you want to exclude
getParsers ( ) : array List of chosen parsers
only ( mixed $only = null ) : object Limits the parsers to only those you specify
parse ( string $source, $caseInsensitive = false ) : string Parses the BBCode string
parseCaseInsensitive ( string $source ) : string Helper function to parse case insensitive
parseCaseSensitive ( string $source ) : string Helper function to parse case sensitive
setParser ( string $name, string $pattern, string $replace, string $content ) : void Sets the parser pattern and replace.
stripBBCodeTags ( string $source ) : string Remove all BBCode

Protected Methods

Method Description
searchAndReplace ( string $pattern, string $replace, string $source ) : string Searches after a specified pattern and replaces it with provided structure

Method Details

__construct() public method

public __construct ( )

except() public method

Removes the parsers you want to exclude
public except ( mixed $except = null ) : object
$except mixed parsers
return object BBCodeParser object

getParsers() public method

List of chosen parsers
public getParsers ( ) : array
return array array of parsers

only() public method

Limits the parsers to only those you specify
public only ( mixed $only = null ) : object
$only mixed parsers
return object BBCodeParser object

parse() public method

Parses the BBCode string
public parse ( string $source, $caseInsensitive = false ) : string
$source string String containing the BBCode
return string Parsed string

parseCaseInsensitive() public method

Helper function to parse case insensitive
public parseCaseInsensitive ( string $source ) : string
$source string String containing the BBCode
return string Parsed text

parseCaseSensitive() public method

Helper function to parse case sensitive
public parseCaseSensitive ( string $source ) : string
$source string String containing the BBCode
return string Parsed text

searchAndReplace() protected method

Searches after a specified pattern and replaces it with provided structure
protected searchAndReplace ( string $pattern, string $replace, string $source ) : string
$pattern string Search pattern
$replace string Replacement structure
$source string Text to search in
return string Parsed text

setParser() public method

This can be used for new parsers or overwriting existing ones.
public setParser ( string $name, string $pattern, string $replace, string $content ) : void
$name string Parser name
$pattern string Pattern
$replace string Replace pattern
$content string Parsed text pattern
return void

stripBBCodeTags() public method

Remove all BBCode
public stripBBCodeTags ( string $source ) : string
$source string
return string Parsed text

Property Details

$parsers public_oe property

public $parsers