Spontaneous-emission control by photonic crystals and nanocavities