コード例 #1
0
ファイル: Expression.php プロジェクト: que273/siremis
 /**
  * Replace macro expression
  * replace macro @var:key to $userProfile[$key]
  * NOTE: NYU - not yet used
  * 
  * @global BizSystem $g_BizSystem
  * @param string $expression
  * @return string
  */
 protected static function replaceMacrosExpr($expression)
 {
     // replace macro @var:key to $userProfile[$key]
     while (true) {
         $pattern = "/@(\\w+):(\\w+)/";
         if (!preg_match($pattern, $expression, $matches)) {
             break;
         }
         $macro = $matches[0];
         $macro_var = $matches[1];
         $macro_key = $matches[2];
         $val = BizSystem::getMacroValue($macro_var, $macro_key);
         if (!$val) {
             $val = "";
         }
         // throw error
         $expression = str_replace($macro, $val, $expression);
     }
     return $expression;
 }