PHP notes
OpenTBS class
Source : http://www.tinybutstrong.com/
Does not format a field according to the frm format. When setting field formats in a DOCX template, there must be no Word formatting between the values and the frm string. Finding the cause without digging into the source is unrealistic. To fix it, select the entire field, clear its formatting, and apply it again. Formats: http://www.tinybutstrong.com/manual.php#html_field_prm_frm
RegExp for obtaining key values from a template. Format: [...]
# consider the following as key-ending characters: (]), (;) , ( ) space
$pattern = '/[\[](.*?)[\]; ]/xi';
preg_match_all( $pattern, $TBS->Source, $matches );
var_dump($matches[1]);
Miscellaneous
(string) is faster than strval() and settype()
Use only array_key_exists, not isset.