Accept and process commands even if they're right at the beginning.

Fixes bug where commands at the start of content were not processed.
This commit is contained in:
Nathan Gray 2014-12-03 19:58:59 +00:00
parent 2eb7795061
commit 681566471a

View File

@ -1324,30 +1324,30 @@ abstract class bo_merge
*/
private function process_commands($content, $replacements)
{
if (strpos($content,'$$IF'))
if (strpos($content,'$$IF') !== false)
{ //Example use to use: $$IF n_prefix~Herr~Sehr geehrter~Sehr geehrte$$
$this->replacements =& $replacements;
$content = preg_replace_callback('/\$\$IF ([0-9a-z_\/-]+)~(.*)~(.*)~(.*)\$\$/imU',Array($this,'replace_callback'),$content);
unset($this->replacements);
}
if (strpos($content,'$$NELF'))
if (strpos($content,'$$NELF') !== false)
{ //Example: $$NEPBR org_unit$$ sets a LF and value of org_unit, only if there is a value
$this->replacements =& $replacements;
$content = preg_replace_callback('/\$\$NELF ([0-9a-z_\/-]+)\$\$/imU',Array($this,'replace_callback'),$content);
unset($this->replacements);
}
if (strpos($content,'$$NENVLF'))
if (strpos($content,'$$NENVLF') !== false)
{ //Example: $$NEPBRNV org_unit$$ sets only a LF if there is a value for org_units, but did not add any value
$this->replacements =& $replacements;
$content = preg_replace_callback('/\$\$NENVLF ([0-9a-z_\/-]+)\$\$/imU',Array($this,'replace_callback'),$content);
unset($this->replacements);
}
if (strpos($content,'$$LETTERPREFIX$$'))
if (strpos($content,'$$LETTERPREFIX$$') !== false)
{ //Example use to use: $$LETTERPREFIX$$
$LETTERPREFIXCUSTOM = '$$LETTERPREFIXCUSTOM n_prefix title n_family$$';
$content = str_replace('$$LETTERPREFIX$$',$LETTERPREFIXCUSTOM,$content);
}
if (strpos($content,'$$LETTERPREFIXCUSTOM'))
if (strpos($content,'$$LETTERPREFIXCUSTOM') !== false)
{ //Example use to use for a custom Letter Prefix: $$LETTERPREFIX n_prefix title n_family$$
$this->replacements =& $replacements;
$content = preg_replace_callback('/\$\$LETTERPREFIXCUSTOM ([0-9a-z_-]+)(.*)\$\$/imU',Array($this,'replace_callback'),$content);