Fix a lot of problems in the parse function

Since it's confusing dealing with both `advanced` and... let's say `traditional` links, I've split the handling of each into separate functions. Also there's a lot of other little changes. 
`isset()` is probably not an optimal check, however it will trigger if there is no active menu item (no Itemid). Then `getActive()` will return `NULL` and `isset()` returns `false` for variables containing `NULL`.
A check using `is_object()` or simply using a boolean check `if ($item)` would be more clear.