ShieldLM: Empowering LLMs as Aligned, Customizable and Explainable Safety Detectors