General framework for two-photon spontaneous emission near plasmonic nanostructures