Class

ContentFormattingParser

Abstract Package: Content\Formatting\parser Copyright: © 2005-2019 PHPBoost License: GNU/GPL-3.0 Author: Benoit SAUTEL ben.popeye@phpboost.com Version: PHPBoost 5.2 - last update: 2018 03 29 Since: PHPBoost 2.0 - 2008 08 10 Contributor: Julien BRISWALTER j1.seth@phpboost.com Contributor: Arnaud GENET elenwii@phpboost.com Contributor: mipel mipel@phpboost.com Located at: content/formatting/parser/ContentFormattingParser.class.php

This class is abstract. It contains tools that are usefull for implement a content parser.

AbstractParser implements FormattingParser
Extended by ContentFormattingParser
Methods summary
public
# __construct( )

Buils a ContentFormattingParser object.

public
# parse( )

Parses the content of the parser

public
# set_forbidden_tags( array $forbidden_tags )

Sets the tags which mustn't be parsed.

public string[]
# get_forbidden_tags( )

Gets the forbidden tags.

public
# set_html_auth( array $array_auth )

Sets the required authorizations that are necessary to post some HTML code which will be displayed by the web browser.

public mixed[]
# get_html_auth( )

Returns the HTML tag auth

protected
# split_imbricated_tag( string & $content, string $tag, string $attributes )

Splits a string accorting to a tag name. Works also with nested tags.

protected static string[]
# preg_split_safe_recurse( $content, $tag, $attributes )

Splits a string according to a regular expression. The matched pattern can be nested and must follow the BBCode syntax, i.e matching [tag=args]content of the tag[/tag]. It returns an array For example, il you have this: $my_str = '[tag=1]test1[/tag]test2[tag=2]test3[tag=3]test4[/tag]test5[/tag]?est6'; You call it like that: ContentFormattingParser::preg_split_safe_recurse($my_str, 'tag', '[0-9]'); It will return you array('', '1', 'test1', 'test2', '2', array('test3', '3', 'test4', 'test5'), 'test6').

protected
# pick_up_tag( $tag, $arguments = '' )

Removes the content of the tag $tag and replaces them by an identifying code. They will be reinserted in the content by the reimplant_tags method. It enables you to treat the whole string enough affecting the interior of some tags. Example: $my_parser contains this content: 'test1[tag=1]test2[/tag]test3' $my_parser->pick_up_tag('tag', '[0-9]'); will replace the content of the parser by 'test1[CODE_TAG_1]test3'

protected boolean
# reimplant_tag( $tag )

reimplants the code which has been picked up by the _pick_up method.

protected
Constants inherited from AbstractParser
PICK_UP, REIMPLANT
Properties summary
protected string[] $html_auth

Authorization of the HTML BBCode tag.

# array()
protected string[] $forbidden_tags

List of the BBCode forbidden tags

# array()