if is not a function #3663

@rbran100
cp/menu add handles external vsites better #3663

The cp menu wizard tries to offer the ability to create a new node when a url is entered that does not exist.  It failed to take into account other vsites.  Now it makes sure the url is valid for the active vsite before offering a new node.  If the url points to an external vsite, just use the url.
Moved 'external vsite' check earlier #3663
cp menu validation state bug #3663

While testing #3663 I noticed that when a menu item failed validation, it sometimes kept the values from before the first pass at validating.  ie, create a menu entry with no title.  It fails because it needs a title.  Add a title and the form passes, but is saved with no title.

Form values were being cached between pages, but they weren't being updated with the new values before being saved for the next page.  This was fixed by swapping an array addition for an array_merge.
Merge pull request #4138 from openscholar/3663-cpmenu_domain

3663 cpmenu domain