Fix for issue #306 / rtrim() expects parameter 1 to be string, object given

The `WPSEO_Frontend->canonical()` method checks for a wp error object, but for some unfathomable reason, sometimes this check fails and a wp error object is still passed to the calling function.

This pull request makes sure that in all places where `WPSEO_Frontend->canonical()` is used, the returned value is checked to be a string before using it.

Issue #306