From 0516bf5f598f1215b23205ad503fb40f77efb113 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 5 Dec 2014 10:44:00 +0000 Subject: [PATCH] Accept and process commands even if they're right at the beginning. Fixes bug where commands at the start of content were not processed. --- etemplate/inc/class.bo_merge.inc.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etemplate/inc/class.bo_merge.inc.php b/etemplate/inc/class.bo_merge.inc.php index 168ba66a0e..916939f45d 100644 --- a/etemplate/inc/class.bo_merge.inc.php +++ b/etemplate/inc/class.bo_merge.inc.php @@ -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);