src/magictag.php
public function do_magic_tag($content){

		// check for magics
		preg_match_all("/\{(.+?)\}/", (string) $content, $magics);
		
		// on found tags
		if(!empty($magics[1])){
			foreach($magics[1] as $magic_key=>$magic_tag){
				$params = explode(':', $magic_tag, 2 );
				if( empty( $params[1] ) ){ continue; }
				// filter a general tag using the second argument as the original tag
				$filter_value = apply_filters( 'caldera_magic_tag', apply_filters( "caldera_magic_tag-{$params[0]}", $params[1] ) , $magics[0][$magic_key]);
				// chech the tag changed
				if( $filter_value !== $params[1] ){
					// on a difference in the tag, replace it.
					$content = str_replace( $magics[0][$magic_key], $filter_value, $content );
				}
			}
		}

		// return content converted or not.
		return $content;

	}
public function do_magic_tag($content){

		// check for magics
		preg_match_all("/\{(.+?)\}/", (string) $content, $magics);
		
		// on found tags
		if(!empty($magics[1])){
			foreach($magics[1] as $magic_key=>$magic_tag){
				$params = explode(':', $magic_tag, 2 );
				if( empty( $params[1] ) ){ continue; }
				// filter a general tag using the second argument as the original tag
				$filter_value = apply_filters( 'caldera_magic_tag', apply_filters( "caldera_magic_tag-{$params[0]}", $params[1] ) , $magics[0][$magic_key]);
				// chech the tag changed
				if( $filter_value !== $params[1] ){
					// on a difference in the tag, replace it.
					$content = str_replace( $magics[0][$magic_key], $filter_value, $content );
				}
			}
		}

		// return content converted or not.
		return $content;

	}
public function do_magic_tag ( $ content ) { // check for magics preg_match_all ( "/\{(.+?)\}/" , ( string ) $ content , $ magics ) ; // on found tags if ( ! empty ( $ magics [ 1 ] ) ) { foreach ( $ magics [ 1 ] as $ magic_key => $ magic_tag ) { $ params = explode ( ':' , $ magic_tag , 2 ) ; if ( empty ( $ params [ 1 ] ) ) { continue ; } // filter a general tag using the second argument as the original tag $ filter_value = apply_filters ( 'caldera_magic_tag' , apply_filters ( "caldera_magic_tag-{$params[0]}" , $ params [ 1 ] ) , $ magics [ 0 ] [ $ magic_key ] ) ; // chech the tag changed if ( $ filter_value !== $ params [ 1 ] ) { // on a difference in the tag, replace it. $ content = str_replace ( $ magics [ 0 ] [ $ magic_key ] , $ filter_value , $ content ) ; } } } // return content converted or not. return $ content ; }
Renders a magic tag

@return    string 	converted string with matched tags replaced
Renders a magic tag