Tidal heating of terrestrial extrasolar planets and implications for their habitability