Liam, got a small issue with this not rendering the page container template in ui.x theme.
What is the regular expression changing?
/<xen:if is="([A-Z\|\&\$\{\}\.\_ ]+)">([\r\n?\t?]+)(<xen:include.*)/i
<xen:if is="$1 || {$loggedInAsUser}">$2$3
Is there a way to do this as a simple replacement so it makes the required addition to ui.x?
Also, when you login as another user, the "revert user" link isn't placed within a list <li> and thus won't style correctly.