static function mark_js_function(&$obj,&$marks=array())
    {
        foreach ($obj as $k=>&$v) {
            switch(gettype($v))
            {
            case "object":
            case "array":
                Utility::mark_js_function($v, $marks);
                break;
            case "string":
                $tsv = trim(strtolower($v));
                if (strpos($tsv, "function")===0  
                    && (strrpos($tsv, "}")===strlen($tsv)-1 
                    || strrpos($tsv, "()")===strlen($tsv)-2)
                ) {
                    $marks[] = trim($v);
                    $obj[$k] = "--js(".(count($marks)-1).")";
                }
                break;
            }
        }
        return $marks;
    }
static function mark_js_function(&$obj,&$marks=array())
    {
        foreach ($obj as $k=>&$v) {
            switch(gettype($v))
            {
            case "object":
            case "array":
                Utility::mark_js_function($v, $marks);
                break;
            case "string":
                $tsv = trim(strtolower($v));
                if (strpos($tsv, "function")===0  
                    && (strrpos($tsv, "}")===strlen($tsv)-1 
                    || strrpos($tsv, "()")===strlen($tsv)-2)
                ) {
                    $marks[] = trim($v);
                    $obj[$k] = "--js(".(count($marks)-1).")";
                }
                break;
            }
        }
        return $marks;
    }
static function mark_js_function ( & $ obj , & $ marks = array ( ) ) { foreach ( $ obj as $ k => & $ v ) { switch ( gettype ( $ v ) ) { case "object" : case "array" : Utility :: mark_js_function ( $ v , $ marks ) ; break ; case "string" : $ tsv = trim ( strtolower ( $ v ) ) ; if ( strpos ( $ tsv , "function" ) === 0 && ( strrpos ( $ tsv , "}" ) === strlen ( $ tsv ) - 1 || strrpos ( $ tsv , "()" ) === strlen ( $ tsv ) - 2 ) ) { $ marks [ ] = trim ( $ v ) ; $ obj [ $ k ] = "--js(" . ( count ( $ marks ) - 1 ) . ")" ; } break ; } } return $ marks ; }
Traverse through the structure of object and find the js function

@param object $obj   The object
@param array  $marks The mark

@return array The new marks
Traverse through the structure of object and find the js function