src/core/framework/core/3rdparty/dwoo/Dwoo/Compiler.php
protected function replaceStringVars($string, $first, $curBlock='')
	{
		$pos = 0;
		if ($this->debug) echo 'STRING VAR REPLACEMENT : '.$string.'<br>';
		// replace vars
		while (($pos = strpos($string, '$', $pos)) !== false) {
			$prev = substr($string, $pos-1, 1);
			if ($prev === '\\') {
				$pos++;
				continue;
			}

			$var = $this->parse($string, $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string':'string')));
			$len = $var[0];
			$var = $this->parse(str_replace('\\'.$first, $first, $string), $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string':'string')));

			if ($prev === '`' && substr($string, $pos+$len, 1) === '`') {
				$string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos-1, $len+2);
			} else {
				$string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos, $len);
			}
			$pos += strlen($var[1]) + 2;
			if ($this->debug) echo 'STRING VAR REPLACEMENT DONE : '.$string.'<br>';
		}

		// handle modifiers
		// TODO Obsolete?
		$string = preg_replace_callback('#("|\')\.(.+?)\.\1((?:\|(?:@?[a-z0-9_]+(?:(?::("|\').+?\4|:[^`]*))*))+)#i', array($this, 'replaceModifiers'), $string);

		// replace escaped dollar operators by unescaped ones if required
		if ($first==="'") {
			$string = str_replace('\\$', '$', $string);
		}

		return $string;
	}
protected function replaceStringVars($string, $first, $curBlock='')
	{
		$pos = 0;
		if ($this->debug) echo 'STRING VAR REPLACEMENT : '.$string.'<br>';
		// replace vars
		while (($pos = strpos($string, '$', $pos)) !== false) {
			$prev = substr($string, $pos-1, 1);
			if ($prev === '\\') {
				$pos++;
				continue;
			}

			$var = $this->parse($string, $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string':'string')));
			$len = $var[0];
			$var = $this->parse(str_replace('\\'.$first, $first, $string), $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string':'string')));

			if ($prev === '`' && substr($string, $pos+$len, 1) === '`') {
				$string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos-1, $len+2);
			} else {
				$string = substr_replace($string, $first.'.'.$var[1].'.'.$first, $pos, $len);
			}
			$pos += strlen($var[1]) + 2;
			if ($this->debug) echo 'STRING VAR REPLACEMENT DONE : '.$string.'<br>';
		}

		// handle modifiers
		// TODO Obsolete?
		$string = preg_replace_callback('#("|\')\.(.+?)\.\1((?:\|(?:@?[a-z0-9_]+(?:(?::("|\').+?\4|:[^`]*))*))+)#i', array($this, 'replaceModifiers'), $string);

		// replace escaped dollar operators by unescaped ones if required
		if ($first==="'") {
			$string = str_replace('\\$', '$', $string);
		}

		return $string;
	}
protected function replaceStringVars ( $ string , $ first , $ curBlock = '' ) { $ pos = 0 ; if ( $ this -> debug ) echo 'STRING VAR REPLACEMENT : ' . $ string . '<br>' ; // replace vars while ( ( $ pos = strpos ( $ string , '$' , $ pos ) ) !== false ) { $ prev = substr ( $ string , $ pos - 1 , 1 ) ; if ( $ prev === '\\' ) { $ pos ++ ; continue ; } $ var = $ this -> parse ( $ string , $ pos , null , false , ( $ curBlock === 'modifier' ? 'modifier' : ( $ prev === '`' ? 'delimited_string' : 'string' ) ) ) ; $ len = $ var [ 0 ] ; $ var = $ this -> parse ( str_replace ( '\\' . $ first , $ first , $ string ) , $ pos , null , false , ( $ curBlock === 'modifier' ? 'modifier' : ( $ prev === '`' ? 'delimited_string' : 'string' ) ) ) ; if ( $ prev === '`' && substr ( $ string , $ pos + $ len , 1 ) === '`' ) { $ string = substr_replace ( $ string , $ first . '.' . $ var [ 1 ] . '.' . $ first , $ pos - 1 , $ len + 2 ) ; } else { $ string = substr_replace ( $ string , $ first . '.' . $ var [ 1 ] . '.' . $ first , $ pos , $ len ) ; } $ pos += strlen ( $ var [ 1 ] ) + 2 ; if ( $ this -> debug ) echo 'STRING VAR REPLACEMENT DONE : ' . $ string . '<br>' ; } // handle modifiers // TODO Obsolete? $ string = preg_replace_callback ( '#("|\')\.(.+?)\.\1((?:\|(?:@?[a-z0-9_]+(?:(?::("|\').+?\4|:[^`]*))*))+)#i' , array ( $ this , 'replaceModifiers' ) , $ string ) ; // replace escaped dollar operators by unescaped ones if required if ( $ first === "'" ) { $ string = str_replace ( '\\$' , '$' , $ string ) ; } return $ string ; }
replaces variables within a parsed string

@param string $string the parsed string
@param string $first the first character parsed in the string, which is the string delimiter (' or ")
@param string $curBlock the current parser-block being processed
@return string the original string with variables replaced
replaces variables within a parsed string