A class of isochronous and non-isochronous nonlinear oscillators