Is there function returns the current site url

The last answer is a bit older and not valid anymore.

Full solution to be found here: