A general polarimetric model for transiting and nontransiting ringed exoplanets