src/classes/CCView/Builder/CCFTemplate.php
private function compile_arrays( $view )
	{	
		$tokens = token_get_all( $view );

		$tags = array( 0 => '' );
		$tag_index = 0;
		$in_tag = false;

		// parse all php tags out of the view
		foreach ( $tokens as $token ) 
		{
			if ( is_array( $token ) ) 
			{
				if ( $token[0] === T_OPEN_TAG )
				{
					$in_tag = true;
				}

				if ( $in_tag && !in_array( $token[0], array( T_INLINE_HTML ) ) ) 
				{				
					$tags[$tag_index] .= $token[1];
				}

				if ( $token[0] === T_CLOSE_TAG )
				{
					$in_tag = false;
					$tag_index++;
				}
			}
			else 
			{
				if ( $in_tag )
				{
					$tags[$tag_index] .= $token;
				}
			}
		}

		// lets make the tags search keys
		$tags = array_flip( $tags );

		// now search and replace var in the php sections
		foreach( $tags as $search => &$replace )
		{
			$replace = preg_replace_callback('/(\$[a-zA-Z0-9\_\.\-\>\;]+)/s', function( $match )
			{ 
				$var = $match[1];

				if ( strpos( $var, '.' ) !== false )
				{
					$buffer = '';
					$length = strlen( $var );
					$inside_arr = false;

					for( $i=0;$i<$length;$i++ )
					{
						$char = $var[$i];

						if ( $char == '.' && !$inside_arr  )
						{
							$buffer .= "['";
							$inside_arr = true;
						}
						else
						{
							if ( $inside_arr && in_array( $char, array( ';', '-', ',' ) ) )
							{
								$buffer .= "']";
								$inside_arr = false;
							}

							if ( $char == '.' )
							{
								$buffer .= "']['";
								$inside_arr = true;
							}
							else
							{
								$buffer .= $char;
							}
						}
					}

					if ( $inside_arr )
					{
						$buffer .= "']";
					}

					$var = $buffer;
				}

				return $var;

			}, $search );
		}

		return CCStr::replace( $view, $tags );
	}
private function compile_arrays( $view )
	{	
		$tokens = token_get_all( $view );

		$tags = array( 0 => '' );
		$tag_index = 0;
		$in_tag = false;

		// parse all php tags out of the view
		foreach ( $tokens as $token ) 
		{
			if ( is_array( $token ) ) 
			{
				if ( $token[0] === T_OPEN_TAG )
				{
					$in_tag = true;
				}

				if ( $in_tag && !in_array( $token[0], array( T_INLINE_HTML ) ) ) 
				{				
					$tags[$tag_index] .= $token[1];
				}

				if ( $token[0] === T_CLOSE_TAG )
				{
					$in_tag = false;
					$tag_index++;
				}
			}
			else 
			{
				if ( $in_tag )
				{
					$tags[$tag_index] .= $token;
				}
			}
		}

		// lets make the tags search keys
		$tags = array_flip( $tags );

		// now search and replace var in the php sections
		foreach( $tags as $search => &$replace )
		{
			$replace = preg_replace_callback('/(\$[a-zA-Z0-9\_\.\-\>\;]+)/s', function( $match )
			{ 
				$var = $match[1];

				if ( strpos( $var, '.' ) !== false )
				{
					$buffer = '';
					$length = strlen( $var );
					$inside_arr = false;

					for( $i=0;$i<$length;$i++ )
					{
						$char = $var[$i];

						if ( $char == '.' && !$inside_arr  )
						{
							$buffer .= "['";
							$inside_arr = true;
						}
						else
						{
							if ( $inside_arr && in_array( $char, array( ';', '-', ',' ) ) )
							{
								$buffer .= "']";
								$inside_arr = false;
							}

							if ( $char == '.' )
							{
								$buffer .= "']['";
								$inside_arr = true;
							}
							else
							{
								$buffer .= $char;
							}
						}
					}

					if ( $inside_arr )
					{
						$buffer .= "']";
					}

					$var = $buffer;
				}

				return $var;

			}, $search );
		}

		return CCStr::replace( $view, $tags );
	}
private function compile_arrays ( $ view ) { $ tokens = token_get_all ( $ view ) ; $ tags = array ( 0 => '' ) ; $ tag_index = 0 ; $ in_tag = false ; // parse all php tags out of the view foreach ( $ tokens as $ token ) { if ( is_array ( $ token ) ) { if ( $ token [ 0 ] === T_OPEN_TAG ) { $ in_tag = true ; } if ( $ in_tag && ! in_array ( $ token [ 0 ] , array ( T_INLINE_HTML ) ) ) { $ tags [ $ tag_index ] .= $ token [ 1 ] ; } if ( $ token [ 0 ] === T_CLOSE_TAG ) { $ in_tag = false ; $ tag_index ++ ; } } else { if ( $ in_tag ) { $ tags [ $ tag_index ] .= $ token ; } } } // lets make the tags search keys $ tags = array_flip ( $ tags ) ; // now search and replace var in the php sections foreach ( $ tags as $ search => & $ replace ) { $ replace = preg_replace_callback ( '/(\$[a-zA-Z0-9\_\.\-\>\;]+)/s' , function ( $ match ) { $ var = $ match [ 1 ] ; if ( strpos ( $ var , '.' ) !== false ) { $ buffer = '' ; $ length = strlen ( $ var ) ; $ inside_arr = false ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ char = $ var [ $ i ] ; if ( $ char == '.' && ! $ inside_arr ) { $ buffer .= "['" ; $ inside_arr = true ; } else { if ( $ inside_arr && in_array ( $ char , array ( ';' , '-' , ',' ) ) ) { $ buffer .= "']" ; $ inside_arr = false ; } if ( $ char == '.' ) { $ buffer .= "']['" ; $ inside_arr = true ; } else { $ buffer .= $ char ; } } } if ( $ inside_arr ) { $ buffer .= "']" ; } $ var = $ buffer ; } return $ var ; } , $ search ) ; } return CCStr :: replace ( $ view , $ tags ) ; }
Search and replace vars with . array access

@param string 	$view
@return void
Search and replace vars with . array access