Page MenuHomePhorge
Diviner Tech Docs PhutilRemarkupBlockStorage

final class PhutilRemarkupBlockStorage
Phorge Technical Documentation (Remarkup)

Remarkup prevents several classes of text-processing problems by replacing tokens in the text as they are marked up. For example, if you write something like this:

//D12//

It is processed in several stages. First the "D12" matches and is replaced with a token, in the form of "<0x01><ID number><literal "Z">". The first byte, "<0x01>" is a single byte with value 1 that marks a token. If this is token ID "444", the text may now look like this:

//<0x01>444Z//

Now the italics match and are replaced, using the next token ID:

<0x01>445Z

When processing completes, all the tokens are replaced with their final equivalents. For example, token 444 is evaluated to:

<a href="http://...">...</a>

Then token 445 is evaluated:

<em><0x01>444Z</em>

...and all tokens it contains are replaced:

<em><a href="http://...">...</a></em>

If we didn't do this, the italics rule could match the "//" in "http://", or any other number of processing mistakes could occur, some of which create security risks.

This class generates keys, and stores the map of keys to replacement text.

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

This method is not documented.
Parameters
$name
$value
Return
wild

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

public function store($text)

This method is not documented.
Parameters
$text
Return
wild

public function restore($corpus, $text_mode)

This method is not documented.
Parameters
$corpus
$text_mode
Return
wild

public function overwrite($key, $new_text)

This method is not documented.
Parameters
$key
$new_text
Return
wild

public function getMap()

This method is not documented.
Return
wild

public function setMap($map)

This method is not documented.
Parameters
array$map
Return
wild